Class MarsagliaBray1964
- java.lang.Object
-
- dev.nm.stat.random.rng.univariate.normal.MarsagliaBray1964
-
- All Implemented Interfaces:
RandomStandardNormalGenerator
,RandomNumberGenerator
,Seedable
public class MarsagliaBray1964 extends Object implements RandomStandardNormalGenerator
The polar method (attributed to George Marsaglia, 1964) is a pseudo-random number sampling method for generating a pair of independent standard normal random variables. This is an acceptance-rejection method so there is no upper-bound on the number of uniforms it may use to generate a sample. Hence, this method is not applicable to quasi-Monte Carlo simulation.- See Also:
- Wikipedia: Marsaglia polar method
- "G. Marsaglia, and T. A. Bray, "A convenient method for generating normal variates," SIAM Review 6:260-264, 1964."
-
-
Constructor Summary
Constructors Constructor Description MarsagliaBray1964()
Construct a random number generator to sample from the standard Normal distribution.MarsagliaBray1964(RandomLongGenerator uniform)
Construct a random number generator to sample from the standard Normal distribution.
-
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
-
MarsagliaBray1964
public MarsagliaBray1964(RandomLongGenerator uniform)
Construct a random number generator to sample from the standard Normal distribution.- Parameters:
uniform
- a uniform random number generator
-
MarsagliaBray1964
public MarsagliaBray1964()
Construct a random number generator to sample from the standard Normal distribution.
-
-
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
-
-