Knuth shuffle: Difference between revisions

Fixing a very common problem that occurs when doing the Knuth Shuffle.
(→‎{{header|NetRexx}}: add version 2 (a la REXX version 2))
(Fixing a very common problem that occurs when doing the Knuth Shuffle.)
Line 432:
for (int i = 0; i < array.Length; i++)
{
int j = random.Next(i, array.Length); // Don't select from the entire array on subsequent loops
T temp = array[i]; array[i] = array[j]; array[j] = temp;
}
Anonymous user