[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 0-32767. 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.
8.2 StdCRandGen
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 0-32767. 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.
8.3 BoroshNiederreiterRandGen
The generator implemented by the BoroshNiederreiterRandGen class is
described in [4, pages 102-104]. 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.
8.4 WatermanRandGen
The generator implemented by the WatermanRandGen class is described in
[4, pages 102-104]. 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.
8.5 MarsagliaMCRandGen
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.
8.6 LavauxJanssensRandGen
The generator implemented by the LavauxJanssensRandGen class is
described in [4, pages 102-104]. 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.
8.7 Knuth28RandGen
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 (231-1)2-1. The
Knuth28RandGen class is based on the equation
Xn = (271828183Xn-1 - 314159269Xn-2) mod (231-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.
8.8 Knuth22RandGen
The generator implemented by the Knuth22RandGen class is described in
[4, pages 102-104]. 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.
8.9 Knuth27RandGen
The generator implemented by the Knuth27RandGen class is described in
[4, pages 102-104]. 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.
8.10 MitchellMooreRandGen
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 255-1. The period has been found to be approximately 285-1.
The MitchellMooreRandGen generator is based on the equation
Xn = (Xn-24 + Xn-55) 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 heap-based 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