Skip to content

Instantly share code, notes, and snippets.

@technicool
Last active October 11, 2015 06:58
Show Gist options
  • Save technicool/3821171 to your computer and use it in GitHub Desktop.
Save technicool/3821171 to your computer and use it in GitHub Desktop.
Random pronounceable password generator
def generate_password
# Our consonants and vowels
c = %w(b c d f g h j k l m n p r s t v w x z ch cr fr nd ng nk nt ph pr rd sh sl sp st th tr lt qu dg)
v = %w(a e i o u y oo ei ie )
s = ['!','@','#','$','%','^','&','*','(',')','-','_','=','+','{','}','|','\\',']','[',';',':',',','.','/','?','>','<']
f = rand%2 == 1
parts = []
word = []
5.times do
word << (f ? c.sample : v.sample)
f = !f
end
parts << word
word = []
2.times do
word << (rand*10).to_i.to_s
end
parts << word
parts << s.sample
parts.shuffle.join
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment