Skip to content

Instantly share code, notes, and snippets.

@r3wt
Created January 14, 2018 20:16
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 r3wt/bb6a868c788f457cba2bb362c2178902 to your computer and use it in GitHub Desktop.
Save r3wt/bb6a868c788f457cba2bb362c2178902 to your computer and use it in GitHub Desktop.
random_password generator in javascript
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