Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Shuffles array in place.
- * @param {Array} a items An array containing the items.
- */
- function shuffle(a) {
- var j, x, i;
- for (i = a.length - 1; i > 0; i--) {
- j = Math.floor(Math.random() * (i + 1));
- x = a[i];
- a[i] = a[j];
- a[j] = x;
- }
- }
Add Comment
Please, Sign In to add comment