Class Ziggurat2000
java.lang.Object
dev.nm.stat.random.rng.univariate.normal.Ziggurat2000
- All Implemented Interfaces:
RandomStandardNormalGenerator
,RandomNumberGenerator
,Seedable
The Ziggurat algorithm is an algorithm for pseudo-random number sampling from the Normal distribution.
This is considerably faster than the two more commonly used methods to generate normally distributed random numbers,
the Marsaglia polar method or the Box-Muller transform, which require at least a logarithm and a square root.
Empirically, however, the Marsaglia polar method and the
BoxMuller
transform seem to have better distributional properties.
There are implementation problems in the original uniform random number generator proposed in the paper.
To improve the quality, we use MWC8222
for the uniform random number generation.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a Ziggurat random normal generator.Ziggurat2000
(RandomLongGenerator uniform) Construct a Ziggurat random normal generator. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Get the next randomdouble
.void
seed
(long... seeds) Seed the random number/vector/scenario generator to produce repeatable experiments.
-
Constructor Details
-
Ziggurat2000
Construct a Ziggurat random normal generator.- Parameters:
uniform
- a uniform random number generator
-
Ziggurat2000
public Ziggurat2000()Construct a Ziggurat random normal generator.
-
-
Method Details
-
seed
public void seed(long... seeds) Description copied from interface:Seedable
Seed the random number/vector/scenario generator to produce repeatable experiments. -
nextDouble
public double nextDouble()Description copied from interface:RandomNumberGenerator
Get the next randomdouble
.- Specified by:
nextDouble
in interfaceRandomNumberGenerator
- Returns:
- the next random number
-