Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members

RandomNormalT< RK > Class Template Reference

#include <abkrand.h>

Inheritance diagram for RandomNormalT< RK >:

Inheritance graph
[legend]
Collaboration diagram for RandomNormalT< RK >:

Collaboration graph
[legend]
List of all members.

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

template<class RK>
class RandomNormalT< RK >


Constructor & Destructor Documentation

template<class RK>
RandomNormalT< RK >::RandomNormalT double  mean,
double  stdDev,
unsigned  seed = UINT_MAX,
Verbosity  verb = Verbosity("silent")
[inline]
 

template<class RK>
RandomNormalT< RK >::RandomNormalT double  mean,
double  stdDev,
const char *  locIdent,
unsigned  counterOverride = UINT_MAX,
Verbosity  verb = Verbosity("silent")
[inline]
 


Member Function Documentation

template<class RK>
RandomNormalT< RK >::operator double  ) 
 

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     }


Member Data Documentation

template<class RK>
double RandomNormalT< RK >::_cachedValue [mutable, private]
 

Definition at line 416 of file abkrand.h.

Referenced by RandomNormalT< RK >::operator double().

template<class RK>
bool RandomNormalT< RK >::_cacheFull [mutable, private]
 

Definition at line 415 of file abkrand.h.

Referenced by RandomNormalT< RK >::operator double().

template<class RK>
double RandomNormalT< RK >::_mu [private]
 

Definition at line 413 of file abkrand.h.

Referenced by RandomNormalT< RK >::operator double().

template<class RK>
double RandomNormalT< RK >::_sigma [private]
 

Definition at line 414 of file abkrand.h.

Referenced by RandomNormalT< RK >::operator double().


The documentation for this class was generated from the following files:
Generated on Mon Apr 25 01:15:24 2005 for Parquete by doxygen 1.3.2