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); }
public Genome(int lengthOfPhrase) { Phrase = RandomGenomeGenerator.RandomChars(lengthOfPhrase).ToArray(); }