0

Is there any way to make random selection in c#?

6th Feb 2017, 1:31 AM
knowledgekeeper
knowledgekeeper - avatar
2 Respuestas
0
Hi, if you mean generating a random number, then yes. First, create an object of the Random class: Random rand = new Random(); then to generate: int number = rand.Next(1,10); this will generate numbers from 1 to 10 (you can change the value in the brackets for a different range)
6th Feb 2017, 4:08 AM
Edi Lipovac
Edi Lipovac - avatar
0
@Edi Lipovac thanks!
6th Feb 2017, 7:41 AM
knowledgekeeper
knowledgekeeper - avatar