Skip to content

Instantly share code, notes, and snippets.

@EvertonSilva
Created November 7, 2013 12:42
Show Gist options
  • Save EvertonSilva/7353994 to your computer and use it in GitHub Desktop.
Save EvertonSilva/7353994 to your computer and use it in GitHub Desktop.
Generate a "random" string in ruby
rand_str = ('a'..'z').to_a
('A'..'Z').to_a.each { |i| rand_str.push(i) }
9.downto(0) { |n| rand_str.push(n) }
rand_str.shuffle[0..9].join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment