Choosing individuals from a population, by a fitness function
I've been working on an algorithm, where I need to choose n individuals from a population of size k, where k is much bigger than n. All individuals have a fitness value, therefore the selection should favor higher fitness values. However, I don't want to simply choose best n individuals, the worse ones should have a chance also. (Natural selection) So, I decided to find the min and max fitness values within population. So, any individual would have p = (current - min) / (max - min) probability to be chosen, but I can not just iterate over all of them, roll the dice and choose one if the