Created
March 27, 2014 01:44
-
-
Save josephok/9798227 to your computer and use it in GitHub Desktop.
Generate a random string with arbitrary length
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
random_string = (length) -> | |
id = "" | |
id += Math.random().toString(36).substr(2) while id.length < length | |
id.substr 0, length |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment