random pronounceable password generator
marcus • May 26th, 2007
a quick & simple random pronounceable password generator for ruby.
def random_pronouncable_password(size = 6) consonants = %w(b c d f g h j k l m n p qu r s t v w x z ch cr fr nd ng nk nt ph pr rd sh sl sp st th tr 0 1 2 3 4 5 6 7 8 9 0) vocals = %w(a e i o u y) alternate=true password='' (size * 2).times do # get a random vocal or consonant chunk = (alternate ? consonants[rand * consonants.size] : vocals[rand * vocals.size]) alternate = !alternate # randomly swap its case & add to password chunk = chunk.swapcase if rand > 0.5 password << chunk end password end
xactly what i was looking for - thanks!