public static void Main()
public static int RandomRange(int a , int b, Random rand)
return rand.Next(Math.Min(a,b), Math.Max(a,b)+1);
public static void MultipleRandomRange()
Random rand = new Random();
Console.WriteLine("Enter two diffrenet numbers (-999,-999 to quit):");
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
if (a == -999 && b == -999)
Console.WriteLine(RandomRange(a,b, rand));