Last Updated: February 25, 2016
·
184
· ifightcrime

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('-')