Skip to content

Instantly share code, notes, and snippets.

@bahelms
Created December 5, 2014 16:28
Show Gist options
  • Save bahelms/a572c6d4a103925c30a4 to your computer and use it in GitHub Desktop.
Save bahelms/a572c6d4a103925c30a4 to your computer and use it in GitHub Desktop.
Random String generation
# Replace the variable 'size' with the desired string length
o = [('a'..'z'), ('A'..'Z'), (0..9)].map { |i| i.to_a }.flatten; string = (0...size).map { o[rand(o.length)] }.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment