Generate Random Numbers C#

Generate a random integer in C#

private static readonly Random random = new Random();
private static readonly object lock_random = new object();
public static int GetRandomNumber(int min, int max)
{
    lock (lock_random)
    {
        return random.Next(min, max);
    }
}

Leave a Reply