I found a method to shuffle an array on the internet.
Random rand = new Random();
shuffledArray = myArray.OrderBy(x => rand.Next()).ToArray();
However, I am a little concerned about the correctness of this method. If OrderBy executes x => rand.Next()
many times for the same item, the results may conflict and result in weird things (possibly exceptions).
I tried it and everything is fine, but I still want to know whether this is absolutely safe and always works as expected, and I can't find the answer by Google.
Could anyone give me some explanations?
Thanks in advance.