protected MutatorResult < Genotype < G > > mutate ( final Genotype < G > genotype , final double p , final Random random ) { final int P = probability . toInt ( p ) ; final ISeq < MutatorResult < Chromosome < G > > > result = genotype . toSeq ( ) . map ( gt -> random . nextInt ( ) < P ? mutate ( gt , p , random ) : MutatorResult . of ( gt ) ) ; return MutatorResult . of ( Genotype . of ( result . map ( MutatorResult :: getResult ) ) , result . stream ( ) . mapToInt ( MutatorResult :: getMutations ) . sum ( ) ) ; }
Mutates the given genotype .