How to Generates Random Numbers within a range in C#?

Posted by Rajnilari2015 under C# category on | Points: 40 | Views : 341
The below code will do this.It will generate random numbers within a range of 1 to 5

public static int GetRandomNumbersInRange()
Random r = new Random();
return r.Next(1, 5);

Comments or Responses

Login to post response