Skip to content

Instantly share code, notes, and snippets.

@luismartinezs
Last active June 18, 2021 07:59
Show Gist options
  • Save luismartinezs/a9ef8d6a952c1625c1875d744ca14a9b to your computer and use it in GitHub Desktop.
Save luismartinezs/a9ef8d6a952c1625c1875d744ca14a9b to your computer and use it in GitHub Desktop.
Shuffle array #js
function shuffleArray(array) {
var m = array.length, t, i;
while (m) {
i = Math.floor(Math.random() * m--);
t = array[m];
array[m] = array[i];
array[i] = t;
}
return array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment