Skip to content

Instantly share code, notes, and snippets.

@lxsmnsyc
Created May 29, 2020 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lxsmnsyc/aa3506053a6595038c77bb4b9eeb3afb to your computer and use it in GitHub Desktop.
Save lxsmnsyc/aa3506053a6595038c77bb4b9eeb3afb to your computer and use it in GitHub Desktop.
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