Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
oldschoolshuffle
function shuffleArray(input) {
for (let i = input.length-1; i >=0; i--) {
const randomIndex = Math.floor(Math.random()*(i+1));
const itemAtIndex = input[randomIndex];
input[randomIndex] = input[i];
input[i] = itemAtIndex;
}
return input;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.