0

How can we generate random numbers in specific range using c#?

17th Jun 2017, 12:40 AM
Khaled Mohammed Saif Alselwi
Khaled Mohammed Saif Alselwi - avatar
3 Antworten
+ 1
Random rand = new Random(); int randNum = rand.next(0, 101); // random number from and including 0 to but not including 101 (0-100)
17th Jun 2017, 12:47 AM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Example: Random rand = new Random(); int rand_number = rand.Next(1, 51) // random numbers from 1 to 50
17th Jun 2017, 12:47 AM
Ulisses Cruz
Ulisses Cruz - avatar
0
yes totally both are correct..
17th Jun 2017, 2:36 AM
Khaled Mohammed Saif Alselwi
Khaled Mohammed Saif Alselwi - avatar