#include <NegExponential.h>
Public Member Functions | |
NegExponential (double mean=0) | |
Creates a new instance of the negative exponential random number generator and initializes the parameter ![]() | |
NegExponential (double mean, RNG &r) | |
Creates a new neg exponential random generator instance by using the pseudo random number generator "r" for the determination of random values and initializes the distribution's parameter ![]() | |
double | mean () const |
Returns the current value of the parameter ![]() | |
void | mean (double newMean) |
Sets the current value of the parameter ![]() | |
double | operator() (double mean) |
Returns a negative exponential random number for the parameter ![]() | |
double | operator() () |
Returns a negative exponential random number for the parameter ![]() | |
double | p (const double &) const |
Returns the probability for the occurrence of random number "x". | |
Protected Attributes | |
double | pMean |
This class is derived from class RandomVar and the uniformally distributed pseudo random number values of the interval (0,1) are transformed to type "double" of the negative exponential distribution (aka exponential distribution), that is given by:
where and
.
Below you can see the distribution for the parameter values ,
and
:
NegExponential::NegExponential | ( | double | mean = 0 |
) |
Creates a new instance of the negative exponential random number generator and initializes the parameter .
Creates a new instance of the negative exponential random number generator and initializes the parameter .
The parameter that is stored in pMean is initialized by mean.
For this instance, the default pseudo random number generator as member of class RandomVar is used.
mean | initial value for pMean (parameter ![]() |
NegExponential::NegExponential | ( | double | mean, | |
RNG & | r | |||
) |
Creates a new neg exponential random generator instance by using the pseudo random number generator "r" for the determination of random values and initializes the distribution's parameter .
Creates a new neg exponential random generator instance by using the pseudo random number generator "r" for the determination of random values and initializes the distribution's parameter .
Each instance of a neg exponential random number generator is based on a generator, that is defined in class RNG and returns uniformally pseudo random numbers of the interval (0,1). By default, this is a global generator named RNG::globalRng and included as member in class RandomVar.
Here another pseudo random number generator r is used instead.
Additionally to defining the used pseudo random number generator, pMean (parameter ) is initialized by mean.
mean | initial value for pMean (parameter ![]() | |
r | the pseudo random number generator that is used |
double NegExponential::mean | ( | ) | const [inline] |
void NegExponential::mean | ( | double | newMean | ) | [inline] |
Sets the current value of the parameter as saved in pMean to the new value "newMean".
newMean | value for pMean (parameter ![]() ![]() |
double NegExponential::operator() | ( | double | mean | ) | [inline] |
Returns a negative exponential random number for the parameter (pMean) set to "mean".
This method performs the inverse transformation of the original uniformally distributed random numbers of the interval (0,1) created by the used pseudo random number generator to the type of the negative exponential distribution.
mean | the value for parameter ![]() |
double NegExponential::operator() | ( | ) | [virtual] |
Returns a negative exponential random number for the parameter as preset in pMean.
Returns a negative exponential random number for the parameter as preset in pMean.
Implements RandomVar< double >.
double NegExponential::p | ( | const double & | x | ) | const [virtual] |
Returns the probability for the occurrence of random number "x".
Returns the probability for the occurrence of random number "x".
The probability is returned for the parameter that is set to pMean.
x | the random number for which the probability is returned |
Implements RandomVar< double >.
double NegExponential::pMean [protected] |
The parameter in the distribution function (see class description for details).