#include <abkrand.h>
Inheritance diagram for RandomNormalT< RK >:
Public Member Functions | |
RandomNormalT (double mean, double stdDev, unsigned seed=UINT_MAX, Verbosity verb=Verbosity("silent")) | |
RandomNormalT (double mean, double stdDev, const char *locIdent, unsigned counterOverride=UINT_MAX, Verbosity verb=Verbosity("silent")) | |
operator double () | |
Private Attributes | |
double | _mu |
double | _sigma |
bool | _cacheFull |
double | _cachedValue |
|
|
|
|
|
Definition at line 69 of file abkrand_templ.cxx. References RandomNormalT< RK >::_cachedValue, RandomNormalT< RK >::_cacheFull, RandomNormalT< RK >::_mu, RandomNormalT< RK >::_sigma, and parquetfp::S.
00070 { 00071 if (_cacheFull) 00072 { 00073 _cacheFull = false; 00074 return _cachedValue; 00075 } 00076 else 00077 { 00078 while(true) 00079 { 00080 double V1,V2,S; 00081 V1 = 2*RK::_getRawDouble()-1; 00082 V2 = 2*RK::_getRawDouble()-1; 00083 S = V1*V1 + V2*V2; 00084 if (S < 1.0) 00085 { 00086 double multiplier = sqrt(-2*log(S)/S); 00087 _cachedValue = _sigma*V1*multiplier + _mu; 00088 _cacheFull = true; 00089 return _sigma*V2*multiplier + _mu; 00090 } 00091 00092 } 00093 } 00094 } |
|
Definition at line 416 of file abkrand.h. Referenced by RandomNormalT< RK >::operator double(). |
|
Definition at line 415 of file abkrand.h. Referenced by RandomNormalT< RK >::operator double(). |
|
Definition at line 413 of file abkrand.h. Referenced by RandomNormalT< RK >::operator double(). |
|
Definition at line 414 of file abkrand.h. Referenced by RandomNormalT< RK >::operator double(). |