Created
April 14, 2009 23:33
-
-
Save miketierney/95493 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # Generates a random string, defaults to 30 characters in length. | |
| def String.random_alphanumeric(size=30) | |
| (1..size).collect { (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61))).chr }.join | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment