Created
January 14, 2018 20:16
-
-
Save r3wt/bb6a868c788f457cba2bb362c2178902 to your computer and use it in GitHub Desktop.
random_password generator in javascript
This file contains hidden or 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
const random_password = (len=64) => { | |
let chars='abcdefghijklmnopqrstuvwxyz123456789-_=+`~:;>,.<}{[]|)(*&^%$#@!'; | |
let password = ''; | |
while(password.length < len) { | |
password+= chars.charAt(Math.floor((Math.random() * chars.length) + 1) % chars.length); | |
} | |
return password; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment