public void Crossover() { float[] levels = new float[Rations.Count]; float sum = 0; for (int i = 0; i < Rations.Count; i++) { sum += Rations[i].Likelihood; levels[i] = sum; } Random rand = new Random(); List <Ration> newRation = new List <Ration>(); for (int i = 0; i < Rations.Count; i++) { Ration fParent = GetRation(levels, (float)rand.NextDouble()); Ration sParent = GetRation(levels, (float)rand.NextDouble()); newRation.Add(Crossover(fParent, sParent)); } Rations = newRation; }