randomGaussian()
Math / RandomDescription
Returns a float from a random series of numbers having a mean of 0 and standard deviation of 1.
Syntax
float randomGaussian()
Parameters
None
Returns
floatRelated
Under the Hood
From Processing.h:
float randomGaussian();
Under the Hood
From Processing.cpp:
float PApplet::randomGaussian(){
static float spare; static bool has=false;
if(has){has=false;return spare;}
float u,v,s;
do{u=_rngDist(_rng)*2-1;v=_rngDist(_rng)*2-1;s=u*u+v*v;}while(s>=1||s==0);
s=std::sqrt(-2*std::log(s)/s);spare=v*s;has=true;return u*s;
}