def rand_readable(*size, use=None, density=6):
    """ Generates a random string with readable characters using
        random module specified in @use

        @*size: #int size range for the length of the string
        @use: the random module to use
        @density: how often to include a vowel, you can expect a vowel about
            once every (density) nth character
        ..
            from redis_structures.debug import rand_readable

            rand_readable()
            # -> 'hyiaqk'

            rand_readable(15, 20)
            # -> 'oqspyywvhifsaikiaoi'

            rand_readable(15, 20, density=1)
            # -> 'oeuiueioieeioeeeue'

            rand_readable(15, 20, density=15)
            # -> 'ktgjabwdqhgeanh'
        ..

    """
    use = use or np.random
    keyspace = [c for c in string.ascii_lowercase if c != "l"]
    vowels = ("a", "e", "i", "o", "u")

    def use_vowel(density): not use.randint(0, density)
    if size:
        size = size if len(size) == 2 else (size[0]-1, size[0])
    else:
        size = (6, 7)
    return ''.join(
        use.choice(vowels if use_vowel(density) else keyspace)
        for _ in range(use.randint(*size)))
def rand_readable ( * size , use = None , density = 6 ) : use = use or np . random keyspace = [ c for c in string . ascii_lowercase if c != "l" ] vowels = ( "a" , "e" , "i" , "o" , "u" ) def use_vowel ( density ) : not use . randint ( 0 , density ) if size : size = size if len ( size ) == 2 else ( size [ 0 ] - 1 , size [ 0 ] ) else : size = ( 6 , 7 ) return '' . join ( use . choice ( vowels if use_vowel ( density ) else keyspace ) for _ in range ( use . randint ( * size ) ) )
Generates a random string with readable characters using
        random module specified in @use

        @*size: #int size range for the length of the string
        @use: the random module to use
        @density: how often to include a vowel, you can expect a vowel about
            once every (density) nth character
        ..
            from redis_structures.debug import rand_readable

            rand_readable()
            # -> 'hyiaqk'

            rand_readable(15, 20)
            # -> 'oqspyywvhifsaikiaoi'

            rand_readable(15, 20, density=1)
            # -> 'oeuiueioieeioeeeue'

            rand_readable(15, 20, density=15)
            # -> 'ktgjabwdqhgeanh'
        ..