Created
April 16, 2012 03:39
-
-
Save mattgorecki/2396242 to your computer and use it in GitHub Desktop.
Revisions
-
There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ import string import itertools import random def gen_pass(): initial_consonants = (set(string.ascii_lowercase) - set('aeiou') # remove those easily confused with others - set('qxc') # add some crunchy clusters | set(['bl', 'br', 'cl', 'cr', 'dr', 'fl', 'fr', 'gl', 'gr', 'pl', 'pr', 'sk', 'sl', 'sm', 'sn', 'sp', 'st', 'str', 'sw', 'tr']) ) final_consonants = (set(string.ascii_lowercase) - set('aeiou') # confusable - set('qxcsj') # crunchy clusters | set(['ct', 'ft', 'mp', 'nd', 'ng', 'nk', 'nt', 'pt', 'sk', 'sp', 'ss', 'st']) ) vowels = 'aeiou' # we'll keep this simple # each syllable is consonant-vowel-consonant "pronounceable" syllables = map(''.join, itertools.product(initial_consonants, vowels, initial_consonants, vowels, final_consonants)) return random.sample(syllables, 1)[0]