I have an array like this one:
int[] numbers = new [] { 1, 2, 3, 4 };
I'd like to randomize this (different each time) so that it makes another array with the same size and numbers but in a different order each time.
Try something like this:
System.Random rnd = new System.Random();
var numbers = Enumerable.Range(1, 4).OrderBy(r => rnd.Next()).ToArray();
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