Created
June 25, 2014 18:38
-
-
Save aarti/e2c355fb3edf8bab3d1f to your computer and use it in GitHub Desktop.
combining ranges into an array using splat operator to generate a random string of two chars
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
# I thought this was neat | |
# Reference: http://stackoverflow.com/questions/21404323/combining-two-different-ranges-to-one-in-ruby | |
[*'0'..'9', *'a'..'z', *'A'..'Z'].shuffle.first(2).join | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment