The Next method has three overloaded forms and allows you to set the minimum and maximum range of the random number.
 
By passing a single maximum value to the Next method, the method generates a random number less than the max value passed in the method. The following code snippet in Listing 2 returns a random number that is less than 100. 
  1. // A random number below 100  
  2. int randomLessThan100 = random.Next(100);  
  3. Console.WriteLine(randomLessThan100);  
Listing 2.