public static Genome MutateGenome(Genome genome, double mutationRate)
 {
     for (int i = 0; i < genome.Phrase.Length; i++)
     {
         genome.Phrase[i] = Random.NextDouble() < mutationRate
             ? RandomGenomeGenerator.RandomChars(1).First()
             : genome.Phrase[i];
     }
     return(genome);
 }
예제 #2
0
 public Genome(int lengthOfPhrase)
 {
     Phrase = RandomGenomeGenerator.RandomChars(lengthOfPhrase).ToArray();
 }