Accord.Genetic.ShortArrayChromosome.Mutate C# (CSharp) Method

Mutate() public method

Mutation operator.

The method performs chromosome's mutation, changing randomly one of its genes (array elements).

public Mutate ( ) : void
return void
        public override void Mutate()
        {
            // get random index
            int i = Generator.Random.Next(length);

            // randomize the gene
            val[i] = (ushort)Generator.Random.Next(maxValue + 1);
        }