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

simth::RayleighRng Class Reference

Rayleigh distributed random number generator. More...

#include <phrand.h>

Inheritance diagram for simth::RayleighRng:

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

Public Member Functions

 RayleighRng (double sigma)
virtual ~RayleighRng ()
double sigma () const
void setSigma (double x)
virtual double get () const
double get_inl () const

Detailed Description

Rayleigh distributed random number generator.

The function get() of this class returns a random variate from the Rayleigh distribution with scale parameter sigma.

The distribution is

\[ p(r) = \left\{ \begin{array}{cl} {r \over \sigma^2} e^{- r^2/(2 \sigma^2)} & \mbox{for } r > 0 \\ 0 & \mbox{elsewhere} \end{array} \right. \]

This distribution has a mean value $\mu_R$ and variance $\sigma_R^2$ of

\[ \mu_R = \sqrt{\frac{\pi}{2}}\sigma \quad,\quad \sigma_R^2 = (2-\frac{\pi}{2})\sigma^2 \approx 0.429\sigma^2 \]

WATCH OUT: The scale factor sigma $\sigma$ is NOT the variance of this random variable!!! The specified parameter $\sigma$ is not even the variance but rather the standard deviation (square root of variance). Instead, if you view the Rayleigh variable as the magnitude of a complex r.v. with real and imaginary part i.i.d. Gaussians, then $\sigma^2$ is the variance of the real and imaginary part separately (and $\sigma$ is its standard deviation). The average power of such a complex r.v. would be the sum of the variances of the real and imaginary part, hence the power would be $2\sigma^2$.

The scale factor sigma is set by the constructor argument and by the function setSigma(). The used precision in this class is double.


Constructor & Destructor Documentation

simth::RayleighRng::RayleighRng double  sigma  ) 
 

Constructor for the random number generator.

Parameters:
sigma The scale parameter for the Rayleigh distribution (not to be confused with the variance of this distribution). Notice that this is sigma, not sigma squared, so you should rather think about this as a value corresponding to a standard deviation instead of to a variance.

virtual simth::RayleighRng::~RayleighRng  )  [virtual]
 


Member Function Documentation

double simth::RayleighRng::sigma  )  const [inline]
 

Returns the scale parameter for the Rayleigh distribution (not to be confused with the variance of this distribution).

void simth::RayleighRng::setSigma double  x  )  [inline]
 

Sets the scale parameter for the Rayleigh distribution (not to be confused with the variance of this distribution)

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

Returns a random variate from the Rayleigh distribution.

Implements simth::RandomGenerator.

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

Non-virtual inline version of get().


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