Skip to content

Instantly share code, notes, and snippets.

@akella
Created September 2, 2017 22:13
Show Gist options
  • Save akella/8eb84efc67a6835e742ffc83e3a6034b to your computer and use it in GitHub Desktop.
Save akella/8eb84efc67a6835e742ffc83e3a6034b to your computer and use it in GitHub Desktop.
function shuffle(a) {
for (let i = a.length; i; i--) {
let j = Math.floor(Math.random() * i);
[a[i - 1], a[j]] = [a[j], a[i - 1]];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment