Skip to content

Instantly share code, notes, and snippets.

@Elevista
Last active March 4, 2016 02:26
Show Gist options
  • Save Elevista/0667ead18b99947642c0 to your computer and use it in GitHub Desktop.
Save Elevista/0667ead18b99947642c0 to your computer and use it in GitHub Desktop.
make random token

Usage

makeToken(10);
;(()=> {
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
this.makeToken = n => {
var arr = [];
for (var i = 0; i < n; i++)
arr.push(chars.charAt(Math.floor(Math.random() * chars.length)));
return arr.join('');
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment