73 double one = 1.0, ntwo = -2.0, twopi = 2.0 * M_PI;
78 c = sqrt(ntwo * log(one - o->
ud(o)));
79 z2 = twopi * o->
ud(o);
81 o->
x.
d = z2 = c * cos(z2);
82 return o->
m.
d + o->
s.
d * z1;
87 return o->
m.
d + o->
s.
d * c;
102 double one = 1.0, two = 2.0;
107 z1 = two*o->
ud(o) - one;
108 z2 = two*o->
ud(o) - one;
111 s = sqrt(-two*log(s)/s);
113 return o->
m.
d + o->
s.
d * z1 * s;
118 return o->
m.
d + o->
s.
d * s;
130 double one = 1.0, half = .5,
132 cc = half * M_2_SQRTPI * M_SQRT1_2 * is,
133 xm = (x - o->
m.
d) * is,
136 return cc * exp(-half * xx);
149 is = M_SQRT1_2 / o->
s.
d,
150 xm = (x - o->
m.
d) * is;
152 return half * (one + erf(xm));
166 float one = 1.0, ntwo = -2.0, twopi = 2.0 * M_PI;
171 c = sqrt(ntwo * log(one - o->
uf(o)));
172 z2 = twopi * o->
uf(o);
174 o->
x.
f = z2 = c * cosf(z2);
175 return o->
m.
f + o->
s.
f * z1;
180 return o->
m.
f + o->
s.
f * c;
194 float one = 1.0, two = 2.0;
199 z1 = two*o->
ud(o) - one;
200 z2 = two*o->
ud(o) - one;
203 s = sqrtf(-two*logf(s)/s);
205 return o->
m.
f + o->
s.
f * z1 * s;
210 return o->
m.
f + o->
s.
f * s;
222 float one = 1.0, half = .5,
224 cc = half * M_2_SQRTPI * M_SQRT1_2 * is,
225 xm = (x - o->
m.
f) * is,
228 return cc * expf(-half * xx);
241 is = M_SQRT1_2 / o->
s.
f,
242 xm = (x - o->
m.
f) * is;
244 return half * (one + erff(xm));
float LRf_gaus_CDF(LR_obj *o, float x)
LRf_gaus_CDF(LR_obj *o, float x) - float Gaussian/Normal cumulative distribution function.
double LRd_gausmar_RAN(LR_obj *o)
LRd_gausmar_RAN(LR_obj *o) - double random Gaussian/Normal distribution using the Marsaglia method wi...
float LRf_gaus_PDF(LR_obj *o, float x)
LRf_gaus_PDF(LR_obj *o, float x) - float Gaussian/Normal probablity distribution function.
double LRd_gaus_CDF(LR_obj *o, double x)
LRd_gaus_CDF(LR_obj *o, double x) - double Gaussian/Normal cumulative distribution function...
double LRd_gausbm_RAN(LR_obj *o)
LRd_gausbm_RAN(LR_obj *o) - double random Gaussian/Normal distribution using the Box-Muller method...
float LRf_gausbm_RAN(LR_obj *o)
LRf_gausbm_RAN(LR_obj *o) - float random Gaussian/Normal distribution using the Box-Muller method...
float LRf_gausmar_RAN(LR_obj *o)
LRf_gausmar_RAN(LR_obj *o) - float random Gaussian/Normal distribution using the Marsaglia method wit...
The LibRan common header file.
double LRd_gaus_PDF(LR_obj *o, double x)
LRd_gaus_PDF(LR_obj *o, double x) - double Gaussian/Normal probablity distribution function...
the fundamental LibRan random variate distribution object