Ejemplo n.º 1
0
/* at cost of a cached  value we could compute two at a time. */
double nrnran123_normal(nrnran123_State* s) {
	double w, x, y;
	double u1 = nrnran123_dblpick(s);
	double u2 = nrnran123_dblpick(s);
	u1 = 2.*u1 - 1.;
	u2 = 2.*u2 - 1.;
	w = (u1*u1) + (u2*u2);
	y = sqrt( (-2.*log(w))/w);
	x = u1*y;
	return x;
}
Ejemplo n.º 2
0
	virtual double asDouble() { return nrnran123_dblpick(s_); }
Ejemplo n.º 3
0
double nrnran123_negexp(nrnran123_State* s) {
	/* min 2.3283064e-10 to max 22.18071 */
	return -log(nrnran123_dblpick(s));
}