import random


def create_random_string(min_length, max_length, upper=False, other=False):
    """
    Creates a random string of letters and numbers.

    For a fixed length, set min_length to the same as max_length.

    :param min_length: int the minimum length of the string
    :param max_length: int the maximum length of the string
    :param upper: bool do we need upper letters
    :param other: bool include other characters.
    :return: random str of letters and numbers
    """
    if min_length > max_length:
        raise Exception(f'min_length({min_length}) '
                        f'cannot be > max_length({max_length}).')

    if min_length == max_length:
        length = min_length
    else:
        length = random.randint(min_length, max_length)

    junk = 'abcdefghijklmnopqrstuvwxyz0123456789'
    if upper:
        junk += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    if other:
        junk += '!"#&/()=?`;:,_-~|%&@£$€{[]}'

    return ''.join((random.choice(junk) for _ in range(length)))