+ 1
How can I generate a random number in C# ?
I want to generate a number a random number between 0 to 5 like when the random function is called first it wil give 2 and 3 when it is called again.
1 ответ
+ 4
Random rnd = new Random();
for (int j = 0; j < 3; j++) {
Console.WriteLine(rnd.Next(6)); //returns random integers >= 0 and < 6
}
// Keep learning & happy coding :D