function // Shuffle (a, // Array // Local variables: i, // Element iterator j) // Element to swap { for ( i = a.length; // Start at the end i; // Iterate over the whole array except the first element j = 0 | // Pick (Math.floor) i * Math.random(), // A random position before the current element // --i // Swap a[i] and a[j] a[j] = [a[--i], a[i] = a[j]] [0] ); }