Created
September 8, 2015 17:22
-
-
Save longlostnick/a68ba0019e55f339d382 to your computer and use it in GitHub Desktop.
Safari like random passwords in ruby
This file contains hidden or 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
BASE = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" | |
def random_string(length = 3) | |
length.times.map { BASE[rand(BASE.length)] }.join | |
end | |
puts 4.times.map { random_string }.join('-') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment