last update 20 Sep 2009 |
#include <cvrNormalDistribution.h>
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 () |
normalDistribution & | copy (const normalDistribution &other) |
normalDistribution & | operator= (const normalDistribution &other) |
virtual const std::string & | name () const |
virtual normalDistribution * | clone () const |
virtual normalDistribution * | newInstance () const |
const parameters & | getParameters () const |
bool | updateParameters () |
Protected Attributes | |
shadows< float > | fshadow_ |
shadows< double > | dshadow_ |
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:
where stands for the mean value and for the standard deviation.
cvr::normalDistribution::normalDistribution | ( | ) |
Default constructor.
cvr::normalDistribution::normalDistribution | ( | const double | mean, | |
const double | sigma | |||
) |
Constructor with a given interval.
mean | mean value () 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 | ) |
virtual cvr::normalDistribution::~normalDistribution | ( | ) | [virtual] |
Destructor.
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.
rnd | double reference where the random number has to be left. |
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.
rnd | double reference where the random number has to be left. |
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 | ) |
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.
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.
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()].
Reimplemented from cvr::univariateContinuousDistribution.
const parameters& cvr::normalDistribution::getParameters | ( | ) | const |
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 | ) |
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()].
Reimplemented from cvr::univariateContinuousDistribution.
bool cvr::normalDistribution::updateParameters | ( | ) | [virtual] |
shadows<double> cvr::normalDistribution::dshadow_ [protected] |
Parameters and status for double precision values.
shadows<float> cvr::normalDistribution::fshadow_ [protected] |
Parameters and status for float precision values.