CVR-Lib last update 20 Sep 2009

cvr::normalDistribution Class Reference
[Continuous random distributions]

Class normalDistribution. More...

#include <cvrNormalDistribution.h>

Inheritance diagram for cvr::normalDistribution:

Inheritance graph
[legend]
Collaboration diagram for cvr::normalDistribution:

Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 The parameters for the class normalDistribution. More...
struct  shadows
 Simple structure to shadow the parameters and precomputations. More...

Public Member Functions

 normalDistribution ()
 normalDistribution (const double mean, const double sigma)
 normalDistribution (const parameters &par)
 normalDistribution (const normalDistribution &other)
virtual ~normalDistribution ()
virtual bool apply (float &rnd)
virtual bool apply (double &rnd)
virtual float fdraw ()
virtual double draw ()
float frand ()
double rand ()
normalDistributioncopy (const normalDistribution &other)
normalDistributionoperator= (const normalDistribution &other)
virtual const std::string & name () const
virtual normalDistributionclone () const
virtual normalDistributionnewInstance () const
const parametersgetParameters () const
bool updateParameters ()

Protected Attributes

shadows< float > fshadow_
shadows< double > dshadow_


Detailed Description

Class normalDistribution.

This class generates (pseudo) random numbers normally distributed with mean and standard deviation specified in the parameters.

The equation for the normal probability density distribution is:

\[ p(x) = \frac{1}{\sigma\sqrt{2\pi}} e^{\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2} \]

where $\mu$ stands for the mean value and $\sigma$ for the standard deviation.

See also:
normalDistribution::parameters.

Constructor & Destructor Documentation

cvr::normalDistribution::normalDistribution (  ) 

Default constructor.

cvr::normalDistribution::normalDistribution ( const double  mean,
const double  sigma 
)

Constructor with a given interval.

Parameters:
mean mean value ($\mu$) of the normal distribution
sigma standard deviation of the distribution

cvr::normalDistribution::normalDistribution ( const parameters par  ) 

Construct a functor using the given parameters.

cvr::normalDistribution::normalDistribution ( const normalDistribution other  ) 

Copy constructor.

Parameters:
other the object to be copied

virtual cvr::normalDistribution::~normalDistribution (  )  [virtual]

Destructor.


Member Function Documentation

virtual bool cvr::normalDistribution::apply ( double &  rnd  )  [virtual]

Get a random number.

Returns a random number distributed accordingly to the type of the current instance.

Parameters:
rnd double reference where the random number has to be left.
Returns:
true if apply successful or false otherwise.

Reimplemented from cvr::univariateContinuousDistribution.

virtual bool cvr::normalDistribution::apply ( float &  rnd  )  [virtual]

Get a random number.

Returns a random number distributed accordingly to the type of the current instance.

Parameters:
rnd double reference where the random number has to be left.
Returns:
true if apply successful or false otherwise.

Reimplemented from cvr::univariateContinuousDistribution.

virtual normalDistribution* cvr::normalDistribution::clone (  )  const [virtual]

Returns a pointer to a clone of this functor.

Reimplemented from cvr::univariateContinuousDistribution.

normalDistribution& cvr::normalDistribution::copy ( const normalDistribution other  ) 

Copy data of "other" functor.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

virtual double cvr::normalDistribution::draw (  )  [virtual]

Virtual method to get a double precision random number.

Returns a random number distributed accordingly to the type of the current instance.

The univariateContinuousDistribution can be used to obtain numbers in the interval [0,max()], where max() is the method of this class.

Returns:
a random float number.

Reimplemented from cvr::univariateContinuousDistribution.

virtual float cvr::normalDistribution::fdraw (  )  [virtual]

Virtual method to get a single precision random number.

Returns a random number distributed accordingly to the type of the current instance.

The univariateContinuousDistribution can be used to obtain numbers in the interval [0,max()], where max() is the method of this class.

Returns:
a random float number.

Reimplemented from cvr::univariateContinuousDistribution.

float cvr::normalDistribution::frand (  ) 

Non-virtual method to get a single precision random number.

Returns a random number distributed accordingly to the type of the current instance.

This method can be used to obtain numbers in the interval [min(),max()].

Returns:
a random float number.

Reimplemented from cvr::univariateContinuousDistribution.

const parameters& cvr::normalDistribution::getParameters (  )  const

Returns used parameters.

Reimplemented from cvr::randomDistribution.

virtual const std::string& cvr::normalDistribution::name (  )  const [virtual]

Returns the complete name of the functor class.

Reimplemented from cvr::univariateContinuousDistribution.

virtual normalDistribution* cvr::normalDistribution::newInstance (  )  const [virtual]

Returns a pointer to a new instance of this functor.

Reimplemented from cvr::univariateContinuousDistribution.

normalDistribution& cvr::normalDistribution::operator= ( const normalDistribution other  ) 

Alias for copy member.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

double cvr::normalDistribution::rand (  ) 

Non-virtual method to get a double precision random number.

Returns a random number distributed accordingly to the type of the current instance.

This method can be used to obtain numbers in the interval [min(),max()].

Returns:
a random double number.

Reimplemented from cvr::univariateContinuousDistribution.

bool cvr::normalDistribution::updateParameters (  )  [virtual]


Member Data Documentation

Parameters and status for double precision values.

Parameters and status for float precision values.


The documentation for this class was generated from the following file:

Generated on Sun Sep 20 22:09:01 2009 for CVR-Lib by Doxygen 1.5.8