import string
import random


def random_string(length=6, chars=string.ascii_letters):
    """
    This function generates random strings with specified lengths.

    :param length: Length of the random string
    :param chars: Charset to choose chracters from
    :return: Randomly generated string

    Example:
        random_string(30, string.ascii_letters + string.digits)

    """
    return "".join(random.choice(chars) for _ in range(length))