SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.random.distribution
Class StandardGaussian

java.lang.Object
  extended by com.numericalmethod.suanshu.stats.random.distribution.Gaussian
      extended by com.numericalmethod.suanshu.stats.random.distribution.StandardGaussian
All Implemented Interfaces:
RandomNumberGenerator

public class StandardGaussian
extends Gaussian

Sample pseudo random numbers from the standard Normal distribution.

This class is more efficient than Gaussian to generate standard gaussian random samples.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.numericalmethod.suanshu.stats.random.distribution.Gaussian
Gaussian.Method
 
Field Summary
 
Fields inherited from class com.numericalmethod.suanshu.stats.random.distribution.Gaussian
mu, sigma
 
Constructor Summary
StandardGaussian()
          Construct a pseudo-random number generator of the standard Gaussian distribution.
StandardGaussian(Gaussian.Method method, RandomNumberGenerator rng)
          Construct a pseudo-random number generator of the standard Gaussian distribution.
 
Method Summary
 double nextDouble()
          This function is more efficient, saving two floating point computations.
 
Methods inherited from class com.numericalmethod.suanshu.stats.random.distribution.Gaussian
seed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardGaussian

public StandardGaussian(Gaussian.Method method,
                        RandomNumberGenerator rng)
Construct a pseudo-random number generator of the standard Gaussian distribution.

Parameters:
method - the sampling method
rng - a uniform random number generator

StandardGaussian

public StandardGaussian()
Construct a pseudo-random number generator of the standard Gaussian distribution.

Method Detail

nextDouble

public double nextDouble()
This function is more efficient, saving two floating point computations. Get the next Gaussian sample.

This method is synchronized so that one call generates two random samples.

Specified by:
nextDouble in interface RandomNumberGenerator
Overrides:
nextDouble in class Gaussian
Returns:
a random standard Gaussian sample

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.