get random value from array c# code example
Example 1: random value in array c#
Random random = new Random();
int value = random.Next(0, array.Length);
Console.Write(array[value]);
Example 2: how to get random numbers in c#
Random rnd = new Random();
int month = rnd.Next(1, 13); // creates a number between 1 and 12
int dice = rnd.Next(1, 7); // creates a number between 1 and 6
int card = rnd.Next(52); // creates a number between 0 and 51