Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

simth::GaussRng Class Reference

The function get() of this class returns a Gaussian random variate, with mean zero and standard deviation sigma. More...

#include <phrand.h>

Inheritance diagram for simth::GaussRng:

simth::RandomGeneratorGsl simth::RandomGenerator List of all members.

Public Member Functions

 GaussRng (double variance)
virtual ~GaussRng ()
double variance () const
void setVariance (double x)
virtual double get () const
double get_inl () const

Protected Attributes

double variance_
double stdDev_

Detailed Description

The function get() of this class returns a Gaussian random variate, with mean zero and standard deviation sigma.

The probability distribution for Gaussian random variates is

\[ p(x) dx = {1 \over \sqrt{2 \pi \sigma^2}} \exp (-x^2 / 2\sigma^2) dx \]

for $x$ in the range $-\infty\ldots+\infty$. Use the transformation $z = \mu + x$ on the numbers returned by gsl_ran_gaussian to obtain a Gaussian distribution with mean $\mu$. This function uses the Box-Mueller algorithm which requires two calls the random number generator r. .

The variance $\sigma^2$ is set by the constructor argument and by the function setVariance(). The used precision in this class is double.


Constructor & Destructor Documentation

simth::GaussRng::GaussRng double  variance  ) 
 

Constructor where the argument specifies the variance

virtual simth::GaussRng::~GaussRng  )  [virtual]
 


Member Function Documentation

double simth::GaussRng::variance  )  const [inline]
 

Returns the variance of the distribution.

void simth::GaussRng::setVariance double  x  )  [inline]
 

Sets the variance of the normal distribution.

virtual double simth::GaussRng::get  )  const [virtual]
 

Returns a random variate from the normal distribution.

Implements simth::RandomGenerator.

double simth::GaussRng::get_inl  )  const [inline]
 

Non-virtual inline version of get().


Member Data Documentation

double simth::GaussRng::variance_ [protected]
 

double simth::GaussRng::stdDev_ [protected]
 


Generated on Mon Apr 24 21:19:20 2006 for simthetic by  doxygen 1.4.1