Skip to content

Instantly share code, notes, and snippets.

@aarti
Created June 25, 2014 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aarti/e2c355fb3edf8bab3d1f to your computer and use it in GitHub Desktop.
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
# 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