Skip to content

Instantly share code, notes, and snippets.

@ph3nx
Created January 17, 2014 12:40
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 ph3nx/8472731 to your computer and use it in GitHub Desktop.
Save ph3nx/8472731 to your computer and use it in GitHub Desktop.
Generate random strings in Ruby. You can use this method for instance to generate random subdomains.
def rand_str length
('a'..'z').to_a.shuffle[0..length].join
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment