主要參考《Numerical Recipes in C++
Box 和 Muller 在
X
X
那麼 X
Marsaglia 和 Bray 在
//
// Gaussian Random Number Generator class
// ref
//
public class GaussianRNG
{
int iset;
double gset;
Random r
public GaussianRNG()
{
r
r
iset =
}
public double Next()
{
double fac
if (iset ==
do {
v
v
rsq = v
} while (rsq >=
fac = Math
gset = v
iset =
return v
} else {
iset =
return gset;
}
}
}
From:http://tw.wingwit.com/Article/program/net/201311/11655.html