Class Ziggurat2000
- java.lang.Object
-
- dev.nm.stat.random.rng.univariate.normal.Ziggurat2000
-
- All Implemented Interfaces:
RandomStandardNormalGenerator
,RandomNumberGenerator
,Seedable
public class Ziggurat2000 extends Object implements RandomStandardNormalGenerator
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 theBoxMuller
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 useMWC8222
for the uniform random number generation.- See Also:
- "George Marsaglia, Wai Wan Tsang, "The Ziggurat Method for Generating Random Variables," Journal of Statistical Software 5 (8), 2000"
- Wikipedia: Ziggurat algorithm
- a C implementation of the Ziggurat algorithm
- another C implementation of the Ziggurat algorithm
- Boaz Nadler. "Design Flaws in the Implementation of the Ziggurat and Monty Python methods (and some remarks on Matlab randn)," The Journal of Business. arXiv:math/0603058v1. 2 March 2006.
-
-
Constructor Summary
Constructors Constructor Description Ziggurat2000()
Construct a Ziggurat random normal generator.Ziggurat2000(RandomLongGenerator uniform)
Construct a Ziggurat random normal generator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
nextDouble()
Get the next randomdouble
.void
seed(long... seeds)
Seed the random number/vector/scenario generator to produce repeatable experiments.
-
-
-
Constructor Detail
-
Ziggurat2000
public Ziggurat2000(RandomLongGenerator uniform)
Construct a Ziggurat random normal generator.- Parameters:
uniform
- a uniform random number generator
-
Ziggurat2000
public Ziggurat2000()
Construct a Ziggurat random normal generator.
-
-
Method Detail
-
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
-
-