Question

I am generating random numbers between 1 and 100.

This is the code I am using:

var random = new Random();
var list = new List<int>();

for(int i = 0; i < 100; i++)
{
   list.Add(random.Next(1,100));
}

I would expect to get a list of random numbers, but they are all the same. What am I doing wrong?

Looking for a job?
Microsoft
Seattle

JP/Morgan Chase
Dallas, Texas

Startup (stealth)
London, UK

Groundswell Cloud Solutions
Vancouver, Canada


Related
C# Singleton design pattern example
Can I deserialize JSON into a dynamic object in C#?