Skip to content

Instantly share code, notes, and snippets.

@jaggedsoft
Forked from photonstorm/gist:5300530
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaggedsoft/a96d1a839663c6a14c49 to your computer and use it in GitHub Desktop.
Save jaggedsoft/a96d1a839663c6a14c49 to your computer and use it in GitHub Desktop.
function shuffleArray(array) {
for (var i = array.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = array[i];
array[i] = array[j];
array[j] = temp;
}
return array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment