Successfully added
Generate Random Numbers in C#
by Patrik
Generate a Random Integers
The following example demonstrates how to generate a random integer.
Random random = new Random();
int num = random.Next();
Call the Next()
method multiple times to get the multiple random numbers, as shown below.
Random random = new Random();
for (int i = 0; i < 4; i++)
{
Console.WriteLine(random.Next());
}
Referenced in:
Comments