import string
import random


def id_generator(length: int = 6, chars: str = string.digits + string.ascii_lowercase + string.ascii_uppercase):
    """ Returns a random id containing chars and digits

    :param length: length of the generated id
    :param chars:  selected range of chars and digits
    :return: a random id containing chars and digits
    """
    return ''.join(random.choice(chars) for _ in range(length))