/// <inheritdoc/>
 public void MutateWeight(EncogRandom rnd, NEATLinkGene linkGene,
         double weightRange)
 {
     double delta = rnd.NextGaussian() * _sigma;
     double w = linkGene.Weight + delta;
     w = NEATPopulation.ClampWeight(w, weightRange);
     linkGene.Weight = w;
 }
        /// <summary>
        ///     Called for each node in the progrmam. If this is a const node, then
        ///     mutate it according to the frequency and sigma specified.
        /// </summary>
        /// <param name="rnd">Random number generator.</param>
        /// <param name="node">The node to mutate.</param>
        private void MutateNode(EncogRandom rnd, ProgramNode node)
        {
            if (node.Template == StandardExtensions.EXTENSION_CONST_SUPPORT)
            {
                if (rnd.NextDouble() < _frequency)
                {
                    ExpressionValue v = node.Data[0];
                    if (v.IsFloat)
                    {
                        double adj = rnd.NextGaussian()*_sigma;
                        node.Data[0] = new ExpressionValue(v.ToFloatValue()
                                                           + adj);
                    }
                }
            }

            foreach (ITreeNode n in node.ChildNodes)
            {
                var childNode = (ProgramNode) n;
                MutateNode(rnd, childNode);
            }
        }