-- To shuffle an array a of n elements (indices 0..n-1): for i from 0 to n-2 do j <- random integer such that i <= j < n exchange a[i] and a[j]