import random


def random_selection(population, fitness, eq):
    """
    Selection of the best two candidates given fitness function
    :param population: list of numpy array
    :param fitness: function to fit
    :param eq: params to fitness function
    :return: tuple of two more promising individuals (numpy vectors)
    """
    result = list(map(lambda x: (x, fitness(eq, x)), population))
    result.sort(key=lambda x: x[1], reverse=True)
    limit = int(len(population)/2)
    x = random.choice(result[:limit])[0]
    y = random.choice(result[:limit])[0]
    #return x, y
    return result[0][0], result[1][0]