Created
March 3, 2014 08:19
-
-
Save felixzapata/9320651 to your computer and use it in GitHub Desktop.
generate a random number and convert it to base 36
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
var rand = function() { | |
return Math.random().toString(36).substr(2); // remove `0.` | |
}; | |
var token = function() { | |
return rand() + rand(); // to make it longer | |
}; | |
token(); // "bnh5yzdirjinqaorq0ox1tf383nb3xr" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment