import random


def generate_equations(allowed_operators, dataset_size, min_value, max_value):
    """Generates pairs of equations and solutions to them.

       Each equation has a form of two integers with an operator in between.
       Each solution is an integer with the result of the operaion.

        allowed_operators: list of strings, allowed operators.
        dataset_size: an integer, number of equations to be generated.
        min_value: an integer, min value of each operand.
        max_value: an integer, max value of each operand.

        result: a list of tuples of strings (equation, solution).
    """
    sample = []
    for _ in range(dataset_size):
        a, b = random.randint(min_value, max_value), random.randint(min_value, max_value)
        op = random.choice(allowed_operators)
        eq = '{}{}{}'.format(a, op, b)
        res = eval(eq)
        sample.append((eq, str(res)))
    return sample