I'm new to C# and have the following piece of code:
int[] ids = { 190483, 184943, 192366, 202556, 169051, 177388, 170890, 146562, 189509 };
for (var i=0; i<50; i++)
{
int randomID = *randomNumberFromIDList*;
Console.WriteLine("Random ID:" + randomID);
}
As you can see, all I'm looking to do is with each loop assign and display a random ID from the list with the randomID being set as an int.
Is there a simple way to do this?
Randomclass, say it's namedrandom. Then just callrandom.Next(ids.Count)and use it as an index.