Top community members
All Wiki Articles Create Wiki Article

Have you ever heard about encyclopedia for code?

What about: Wiki for Code project?

* because I've tried to share code and my solutions on different services and it was removed or I was unwelcomed
   - maybe it wasn't good place, but this one is.

if you think you have solution that can help someone, you are welcome to share this solution - Click here

C#/.NET - random int

0 contributions
12 points

In C#/.NET is possible to generate random int in few ways.

1. Random int example

Random random = new Random();
int value = random.Next();
Console.WriteLine(value);

Output:

1069169069

2. Random int with max value example

Random random = new Random();
int value = random.Next(100);
Console.WriteLine(value);

Output:

58
Note: random value will be from 0 to 99 (100-1).

3. Random int from range example

Random random = new Random();
int value = random.Next(10 + 1, 100 + 1);
Console.WriteLine(value);

Output:

34
Note: random value will be from 11 to 100.
0 contributions

Suggested wiki articles:

Suggested findings

Let's do the work and have some fun
  • Dirask is online IT community for professionals and hobbyist to share their knowledge and help each other in extraordinary easy way. ❤ 💻 🙂
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    we will help you. 👍 ✔ 🦄
Read more