latest version v1.9 - last update 10 Apr 2010 |
Uniform distributed random number class. More...
#include <ltiUniformDist.h>
Classes | |
class | parameters |
parameters class for the uniform distribution More... | |
Public Member Functions | |
uniformDistribution (const double &lower=0.0, const double &upper=1.0) | |
uniformDistribution (const double &lower, const double &upper, const unsigned int seed) | |
uniformDistribution (const parameters &theParams) | |
virtual | ~uniformDistribution () |
const parameters & | getParameters () const |
virtual bool | updateParameters () |
virtual double | draw () const |
virtual functor * | clone () const |
virtual const char * | getTypeName () const |
Protected Attributes | |
double | m |
double | b |
Uniform distributed random number class.
lti::uniformDistribution::uniformDistribution | ( | const double & | lower = 0.0 , |
|
const double & | upper = 1.0 | |||
) |
default constructor.
Sets lower (inclusive) and upper (exclusive) limit of the distribution.
Referenced by clone().
lti::uniformDistribution::uniformDistribution | ( | const double & | lower, | |
const double & | upper, | |||
const unsigned int | seed | |||
) |
Constructor.
Sets lower (inclusive) and upper (exclusive) limit of the distribution. Additionally, it initializes the random number generation with the given seed. This is sometimes necessary, when the algorithms that uses random number, still should behave "deterministically", in the sense that the results should always be the same.
The value of the seed follows the same rules as the C function srand.
If you don't know what to give, just give "1".
lti::uniformDistribution::uniformDistribution | ( | const parameters & | theParams | ) |
constructor, sets the parameters
virtual lti::uniformDistribution::~uniformDistribution | ( | ) | [inline, virtual] |
destructor
virtual functor* lti::uniformDistribution::clone | ( | ) | const [inline, virtual] |
returns a pointer to a clone of the functor.
Reimplemented from lti::continuousRandomDistribution.
References uniformDistribution().
virtual double lti::uniformDistribution::draw | ( | ) | const [virtual] |
Draws a uniform distributed random number between lowerLimit (inclusive) and upperLimit (exclusive).
Use lowerLimit>upperLimit if you want to have numbers excluding the lower limit (=upperLimit) and including the upper limit (=lowerLimit).
Reimplemented from lti::continuousRandomDistribution.
const parameters& lti::uniformDistribution::getParameters | ( | ) | const |
returns the current parameters.
Reimplemented from lti::functor.
virtual const char* lti::uniformDistribution::getTypeName | ( | void | ) | const [inline, virtual] |
returns the name of this type
Reimplemented from lti::continuousRandomDistribution.
virtual bool lti::uniformDistribution::updateParameters | ( | ) | [virtual] |
set functor's parameters.
This member makes a copy of theParam: the functor will keep its own copy of the parameters!
Reimplemented from lti::functor.
double lti::uniformDistribution::b [protected] |
shift constant
double lti::uniformDistribution::m [protected] |
scaling constant for random number generator