Created
May 29, 2020 07:50
-
-
Save lxsmnsyc/aa3506053a6595038c77bb4b9eeb3afb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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