summaryrefslogtreecommitdiff
path: root/poezio/utils.py
blob: 124d2002eb984775962c50283223fa3ca4ef602a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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