I would like to make a for loop that loops through the numbers 0-8 in a random order. Note that every number can only be visited once.
How can I achieve this?
Random r = new Random();
foreach (int i in Enumerable.Range(0, 9).OrderBy(x => r.Next()))
{
Console.WriteLine(i);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With