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('-')
Written by Nick Larson
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#