Created
July 17, 2014 20:18
-
-
Save renews/d866fd2f979cc6ef20a4 to your computer and use it in GitHub Desktop.
Generate random strings.
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
(0...8).map { (65 + rand(26)).chr }.join | |
I spend too much time golfing. | |
(0...50).map { ('a'..'z').to_a[rand(26)] }.join | |
For lots of good WTFBBQ factor. | |
And a last one that's even more confusing, but more flexible and wastes less cycles: | |
o = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten | |
string = (0...50).map { o[rand(o.length)] }.join |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment