private Strategy RouletteSelectParent() { var randomizer = new Randomizer(); // thread-specific version // using Roulette Wheel Selection, we grab a possibility proportionate to it's fitness compared to // the total fitnesses of all possibilities double randomValue = randomizer.GetDoubleFromZeroToOne() * totalFitness; for (int i = 0; i < currentEngineParams.PopulationSize; i++) { randomValue -= currentGeneration[i].Fitness; if (randomValue <= 0) { return(currentGeneration[i]); } } return(currentGeneration[currentEngineParams.PopulationSize - 1]); }