[ThinAir Home]
[Table of Contents]
[Concrete Classes]
[Special Generators]
8 Generator Instantiations
8.1 BorlandRandGen
The BorlandRandGen class implements the generator from the
rand()
function supplied in the Borland C++ v4.5 standard library. This
generator is derived from the LinConRandGen class and is implemented
in the file erndlcon.h. Although the generator itself retains 32 bits
of seed, the output range is limited to 032767. The constructor for this
class has the following prototype:
 explicit BorlandRandGen( size_rand seed )

Requires a
seed
value. This seed
defaults to 1 if none is
supplied.
The StdCRandGen class implements the generator from the rand()
function described in the ANSI C Standard ([7]). This generator
is derived from the LinConRandGen class and is implemented in the file
erndlcon.h. Although the generator itself retains 32 bits of seed, the
output range is limited to 032767. The constructor for this class has the
following prototype:
 explicit StdCRandGen( size_rand seed )

Requires a
seed
value. This seed
defaults to 1 if none is
supplied.
The generator implemented by the BoroshNiederreiterRandGen class is
described in [4, pages 102104]. It is derived from
MultConRandGen and is implemented in the file erndmcon.h. This
generator did very well on the spectral test for dimensions 2, 3, and 5,
according to Knuth. The constructor for this class has the following prototype:
 explicit BoroshNiederreiterRandGen( size_rand seed )

Requires a
seed
value. This seed
defaults to 1 if none is
supplied.
The generator implemented by the WatermanRandGen class is described in
[4, pages 102104]. It is derived from MultConRandGen and
is implemented in the file erndmcon.h. This generator did very well on
the spectral test for dimensions 2, 3, 4, and 5, according to Knuth. The
constructor for this class has the following prototype:
 explicit WatermanRandGen( size_rand seed )

Requires a
seed
value. This seed
defaults to 1 if none is
supplied.
The MarsagliaMCRandGen class implements a Multiplicative random number
generator that was nominated by George Marsaglia as ``a candidate for the best
of all multipliers'' according to [4]. This distinction was based on
the spectral test for dimensions 2 through 5, and partly because the multiplier
is easy to remember. It is derived from MultConRandGen and is
implemented in the file erndlcon.h. The constructor for this class has
the following prototype:
 explicit MarsagliaMCRandGen( size_rand seed )

Requires a
seed
value. This seed
defaults to 1 if none is
supplied.
The generator implemented by the LavauxJanssensRandGen class is
described in [4, pages 102104]. It is derived from
MultConRandGen and is implemented in the file erndlcon.h. This
generator did very well on the spectral test for dimensions 2 through 6,
according to Knuth. The constructor for this class has the following prototype:
 explicit LavauxJanssensRandGen( size_rand seed )

Requires a
seed
value. This seed
defaults to 1 if none is
supplied.
The Knuth28RandGen class is derived from SecConModRandGen and
is implemented in the file erndsecm.h. In [4], this
generator is described as having a period length of (2^{31}1)^{2}1. The
Knuth28RandGen class is based on the equation
X_{n} = (271828183X_{n1}  314159269X_{n2}) mod (2^{31}1).
Although it does have a long period, this generator only did very well on
dimensions 2 and 3 of the spectral test, according to Knuth. The constructor
for this class has the following prototype:
 explicit Knuth28RandGen( size_rand seed )

Requires a
seed
value. This seed
defaults to 1 if none is
supplied.
The generator implemented by the Knuth22RandGen class is described in
[4, pages 102104]. It is derived from MultConModRandGen
and is implemented in the file erndmcnm.h. This generator did very well
on the spectral test for dimension 2, according to Knuth. The constructor for
this class has the following prototype:
 explicit Knuth22RandGen( size_rand seed )

Requires a
seed
value. This seed
defaults to 1 if none is
supplied.
The generator implemented by the Knuth27RandGen class is described in
[4, pages 102104]. It is derived from MultConModRandGen
and is implemented in the file erndmcnm.h. This generator did very well
on the spectral test for dimensions 2 through 6, according to Knuth. The
constructor for this class has the following prototype:
 explicit Knuth27RandGen( size_rand seed )

Requires a
seed
value. This seed
defaults to 1 if none is
supplied.
The generator implemented by the MitchellMooreRandGen class is
described in [4, page 26]. The class is derived from the
LaggedFibonacciModRandGen and is implemented in the file
erndlfib.h. This generator has a number of interesting properties. The
least significant bits of any sequence generated by this generator will have a
period of 2^{55}1. The period has been found to be approximately 2^{85}1.
The MitchellMooreRandGen generator is based on the equation
X_{n} = (X_{n24} + X_{n55}) mod m. Knuth had reported that the main
reason for not using this generator was a lack of theory regarding its
operation. Since that time, research reported in [6]
shows that generators of this type can be quite good. The constructor for this
class has the following prototype:
 explicit MitchellMooreRandGen( unsigned long mod, RandomGenerator *pRng )

Requires a pointer to a heapbased PRNG object. The
MitchellMooreRandGen object owns this PRNG and
delete
s
it when the object is destroyed. The mod
parameter defines the
modulus used in the calculations.
For further information, contact G. Wade Johnson
(gwadej@anomaly.org).
© 1997 G. Wade Johnson.
All rights reserved.
http://www.anomaly.org/ThinAir/instantn.html