I'm new to programming so please bear with me!
I am trying to set the parts of an array to random values, but whenever I run the program it sets all parts of the array to the same value. I want them all to be different.
Here is my code:
int[] hello_array = new int[10];
Console.WriteLine("Here");
Random rndm = new Random();
for (int j = 0; j < hello_array.Length; j++)
{
hello_array[j] = rndm.Next(99);
}
Console.WriteLine("Now Here");
for (int i = 0; i < hello_array.Length; i++)
{
Console.WriteLine("hahahaha look at this " + hello_array[0]);
I'm probably completely missing it, but I can't tell what's wrong with my code! Can someone please tell me how I would make it so that all ten parts of the array generate different random numbers?