mutate method
Implementation
void mutate(P phenotype, {num? mutationRate, num? mutationStrength}) {
mutationRate ??= this.mutationRate;
mutationStrength ??= this.mutationStrength;
var random = math.Random();
for (var i = 0; i < phenotype.genes.length; i++) {
if (random.nextDouble() < mutationRate) {
phenotype.genes[i] =
phenotype.mutateGene(phenotype.genes[i], mutationStrength);
}
}
}