diff options
Diffstat (limited to 'poezio/utils.py')
-rw-r--r-- | poezio/utils.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/poezio/utils.py b/poezio/utils.py new file mode 100644 index 00000000..124d2002 --- /dev/null +++ b/poezio/utils.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" + Utilities +""" + +from random import choice + +VOWELS = 'aiueo' +CONSONANTS = 'bcdfghjklmnpqrstvwxz' + + +def pronounceable(length: int = 6) -> str: + """Generates a pronounceable name""" + out = '' + vowels = choice((True, False)) + for _ in range(0, length): + out += choice(VOWELS if vowels else CONSONANTS) + vowels = not vowels + return out |