com.metsci.glimpse.util.math.stochastic.pdfcont
Class PdfContGaussianZiggurat
java.lang.Object
com.metsci.glimpse.util.math.stochastic.pdfcont.PdfContGaussianZiggurat
- All Implemented Interfaces:
- Pdf, PdfCont
public class PdfContGaussianZiggurat
- extends java.lang.Object
- implements PdfCont
This routine is based on the following article, with a couple of
modifications which simplify the implementation.
George Marsaglia, Wai Wan Tsang
The Ziggurat Method for Generating Random Variables
Journal of Statistical Software, vol. 5 (2000), no. 8
http://www.jstatsoft.org/v05/i08/
The modifications are:
1) use 128 steps instead of 256 to decrease the amount of static
data necessary.
2) use an acceptance sampling from an exponential wedge
exp(-R*(x-R/2)) for the tail of the base strip to simplify the
implementation. The area of exponential wedge is used in
calculating 'v' and the coefficients in ziggurat table, so the
coefficients differ slightly from those in the Marsaglia and Tsang
paper.
See also Leong et al, "A Comment on the Implementation of the
Ziggurat Method", Journal of Statistical Software, vol 5 (2005), no 7.
- Author:
- osborn
Method Summary |
double |
draw(Generator g)
Returns a random draw from this PDF using the provided
StochasticEngine.Generator object. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PdfContGaussianZiggurat
public PdfContGaussianZiggurat(double mean,
double stdev)
draw
public double draw(Generator g)
- Description copied from interface:
PdfCont
- Returns a random draw from this PDF using the provided
StochasticEngine.Generator object.
- Specified by:
draw
in interface PdfCont
Copyright © 2012 Metron, Inc.. All Rights Reserved.