Random Numbers
.NET has a Random class
The Next function has a parameter that allows you to specify a range of integers you want returned.
System.Random rnd = new System.Random();
int month = rnd.Next(1, 100); // creates a number between 1 and 100
Passing in 10 returns numbers from 0 to 9.
System.Random rnd = new System.Random();
int number = rnd.Next(10);
Not passing in a value returns numbers from 0 to 1.
System.Random rnd = new System.Random();
double number = rnd.NextDouble();
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext