AForge.Genetic.ExtendedGeneFunction.Generate C# (CSharp) Method

Generate() public method

Randomize gene with random value.

The method randomizes a gene, setting its value randomly, but type is set to the specified one.

public Generate ( GPGeneType type ) : void
type GPGeneType Gene type to set.
return void
        public void Generate( GPGeneType type )
        {
            // gene type
            this.type = type;
            // gene value
            val = rand.Next( ( type == GPGeneType.Function ) ? FunctionsCount : variablesCount );
            // arguments count
            argumentsCount = ( type == GPGeneType.Argument ) ? 0 :
                ( val <= (int) Functions.Divide ) ? 2 : 1;
        }

Same methods

ExtendedGeneFunction::Generate ( ) : void