Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function shuffle(str) {
let out = "";
while (str.length > 0) {
const index = (str.length * Math.random()) | 0;
out += str[index];
str = str.substr(0, index) + str.substr(index + 1);
}
return out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment