Skip to content

Instantly share code, notes, and snippets.

@oboshto
Last active February 1, 2017 15:45
Show Gist options
  • Select an option

  • Save oboshto/7e6fe59c47b166ecb9da419d67b7c979 to your computer and use it in GitHub Desktop.

Select an option

Save oboshto/7e6fe59c47b166ecb9da419d67b7c979 to your computer and use it in GitHub Desktop.
array shuffle
let shuffle = function (array) {
for (let i = array.length - 1; i > 0; i -= 1) {
let j = Math.floor(Math.random() * (i + 1));
let 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