LinearCongruentialGenerator ClassEncog Machine Learning Framework for .Net
A predictable random number generator. This is useful for unit tests and benchmarks where we want random numbers, but we want them to be the same each time. This class exists on both Java and C# so it can even provide consistent random numbers over the two platforms. Random numbers are created using a LCG. http://en.wikipedia.org/wiki/Linear_congruential_generator
Inheritance Hierarchy

System Object
  Encog.MathUtil LinearCongruentialGenerator

Namespace: Encog.MathUtil
Assembly: encog-core-cs (in encog-core-cs.dll) Version: 3.3.0.0 (3.3.0.0)
Syntax

public class LinearCongruentialGenerator

The LinearCongruentialGenerator type exposes the following members.

Constructors

  NameDescription
Public methodLinearCongruentialGenerator(Int64)
Construct the default LCG. You need only specify a seed.
Public methodLinearCongruentialGenerator(Int64, Int64, Int64, Int64)
Create a LCG with the specified modulus, multiplier and increment. Unless you REALLY KNOW WHAT YOU ARE DOING, just use the constructor that just takes a seed. It will set these values to the same as set by the GCC C compiler. Setting these values wrong can create fairly useless random numbers.
Top
Methods

  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodNextDouble
The next random number as a double between 0 and 1.
Public methodNextLong
The next random number as a long between 0 and MAX_RAND.
Public methodRange
Generate a random number in the specified range.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Fields

  NameDescription
Public fieldStatic memberMaxRand
The maximum rand number that the standard GCC based LCG will generate.
Top
Properties

  NameDescription
Public propertyIncrement
The amount to increment.
Public propertyModulus
The modulus.
Public propertyMultiplier
The multiplier.
Public propertySeed
The current seed, set to an initial value and always holds the value of the last random number generated.
Top
See Also