​​Generate Random Numbers in Range



Use the Next(int) method overload to generate a random integer that is less than the specified maximum value.



The following example generates the positive random numbers that are less than 10.