Random
creates pseudo-random numbers one by one. This sequence of random numbers is controlled by the seed number. Two sequences of random numbers will be identical if their seeds are identical. The numbers within the sequence are random: in a sense that you can't predict the next number in the sequence.
In case of Random
, where does the seed come from? It depends on which constructor was used. Random()
creates a default seed. Random(Int32)
uses the seed passed by the calling code.
The code in the O.P. creates a new random number generator object in every iteration of the loop. Every time, the seed is the same default. Every time, the first number in the sequence of pseudo-random numbers is the same.
So, create one Random
outside of the loop and use the same Random
for every iteration of the loop.
Console.WriteLine("How many times would you like to roll?");
string strCount = Console.ReadLine();
int n = Convert.ToInt32(strCount);
Random die = new Random();
for (int i = 1; i <= n; i++)
{
int roll = die.Next(1, 6);
Console.WriteLine("Die {0} landed on {1}.", i, roll);
}
Console.ReadLine();