Last active
October 11, 2015 06:58
-
-
Save technicool/3821171 to your computer and use it in GitHub Desktop.
Random pronounceable password generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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