- 1
How to use random in C#?
- Random element in arrat choice. - Random integer from an interval choice.
2 Answers
+ 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
0
Для начала создаём сам рандом.
Random rnd=new Random();
// rnd - название рандома
/* потом можем присвоить переменной рандомное значение */
int a = rnd.Next(Тут вводим значения пример 1-2)