Skip to content

Instantly share code, notes, and snippets.

@XTalandier
Created August 24, 2013 13:30
Show Gist options
  • Save XTalandier/6328153 to your computer and use it in GitHub Desktop.
Save XTalandier/6328153 to your computer and use it in GitHub Desktop.
Generate a random password
function getRandomPasswd(size){
var alfa = 'azertyuiopqsdfghjklmWXCVBN1234567890AZERTYUIOPQSDFGHJKLMWXCVBN';
var rnd = function (s) {
return Math.floor((Math.random() * s));
};
var pass = '';
for (var i = 0; i < size; i++) {
pass += alfa[rnd(alfa.length)]
};
return pass;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment