Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Safari like random passwords in ruby
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
You can’t perform that action at this time.