Skip to content

Instantly share code, notes, and snippets.

@iskolbin
Last active January 12, 2021 10:10
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 iskolbin/000ce6a62fd919211d7328337bbd9647 to your computer and use it in GitHub Desktop.
Save iskolbin/000ce6a62fd919211d7328337bbd9647 to your computer and use it in GitHub Desktop.
function shuffle(array) {
for (let i = array.length-1; i > 0; i--) {
var j = Math.floor(Math.random() * (i+1));
var tmp = array[i];
array[i] = array[j];
array[j] = tmp;
}
return array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment