def random_sample(random_state, population, sample_size):
    """Samples a given number of points from the population without replacement.

    Floyd's algorithm.

    Args:
        random_state: RandomState instance.
        population: An iterable from which to draw our sample.
        sample_size: Integer, How many elements to return. Must be <= len(population).

    Returns:
        Set with sample_size elements.
    """
    sample = set()
    pop_size = len(population)
    if pop_size < sample_size:
        raise ValueError('Sample size exceeds population size.')
    for i in range(pop_size - sample_size, pop_size):
        ind = random_state.randint(0, i + 1)
        if population[ind] not in sample:
            sample.add(population[ind])
        else:
            sample.add(population[i])
    return sample