- 1

How to use random in C#?

- Random element in arrat choice. - Random integer from an interval choice.

20th Nov 2017, 11:08 AM
qas.rus
qas.rus - avatar
2 Respuestas
+ 1
You can use the Random class Declaration: Random random = new Random(); Use: random.Next(); You can also give it a minimum and maximum value like this: random.Next(3,7); This would give you a random number between 3 and 7 (inclusive) Hope this helped you with your question :P
20th Nov 2017, 12:52 PM
Nick
Nick - avatar
0
Для начала создаём сам рандом. Random rnd=new Random(); // rnd - название рандома /* потом можем присвоить переменной рандомное значение */ int a = rnd.Next(Тут вводим значения пример 1-2)
20th Nov 2017, 7:09 PM
WhiteWolf