Click or drag to resize

RandEcuyer88 Class

Note: This API is now obsolete.

Pierre L'Ecuyer's 1988 random number generator that combines two 32-bit MLCGs for a period of approximately 1018. This is the plain original 1988 algorithm without any safeguards or adjustments like those found in the RandEcuyer88S class. The class remains in this library as a historical reference.
Inheritance Hierarchy
SystemObject
  SystemRandom
    Orthogonal.Common.Basic.PRNGRandCustomBase
      Orthogonal.Common.Basic.PRNGRandEcuyer88

Namespace: Orthogonal.Common.Basic.PRNG
Assembly: Orthogonal.Common.Basic (in Orthogonal.Common.Basic.dll) Version: 2024-04-15 18:00 GMT+10.f27da1471008deaf16b803c17e24a5955690aef1
Syntax
C#
[ObsoleteAttribute("This legacy PRNG algorithm should replaced with a more modern and effective one")]
public sealed class RandEcuyer88 : RandCustomBase

The RandEcuyer88 type exposes the following members.

Constructors
 NameDescription
Public methodRandEcuyer88 Constructs an Ecuyer 1988 random class with random seed values.
Public methodRandEcuyer88(Int32, Int32) Constructs an Ecuyer 1988 random class with specified seed values.
Top
Remarks

This class is included in the library for historical reference. In 1988 it demonstrated the innovative technique of combining LGCs with different periods to create a maximal combined generator. Unfortunately, the internal state is a (large) subset of all possible positive Int32 values, so it generates uniform random numbers that cannot generate all possible 32-bit integer values through the standard Next method. See the following notes. The class should not be used in practise because modern efficient and better behaved replacements are available.

The internal generated 'z' value only takes value from 0 to 2147483561 inclusive, which is 86 less than the number of possible postitive Int32. This means that when the state is converted to a double and multiplied by Int32.MaxValue then some Int32 values cannot be produced. Experiments show for example that 25264513 and 50529026 will not be produced, and somewaht confusingly, neither is expected top Next() value 2147483646 0x7FFFFFFE (max int 2147483647 0x7FFFFFFF is impossible by design). The range of Int32 produced by Next(Int32) will therefore be from 0 to 2147483645 0x7FFFFFFD inclusive with some unproducable numbers evenly distributed through the range.

See: Efficient and Portable Combined Random Number Generators

Long running tests have observed the expected minimum values Next 0 (0x0) from Core 0.0 and the maximum Next 2147483645 (0x7FFFFFFD) from Core 0.999999999534339.

See Also