#include <DiffGeometric.h>
Public Member Functions | |
DiffGeometric (double mean=0) | |
Creates a new instance of the differential geometric random number generator and sets the probability for a single Bernoulli trial. | |
DiffGeometric (double mean, RNG &r) | |
Creates a new differential geometric random generator instance by using the pseudo random number generator "r" for the determination of random values and sets the probability for a single Bernoulli trial. | |
long | operator() (double mean) |
For a given probability "mean" for a single Benoulli trial, this method returns a differential geometric random number as difference between two geometric random numbers (trial difference). | |
long | operator() () |
For the current probability for a single Benoulli trial stored in Geometric::pMean, this method returns a differential geometric random number as difference between two geometric random numbers (trial difference). | |
double | p (const long &) const |
For a value "x" of trial difference, this method returns the probability as given by the distribution function. |
This class is derived from class Geometric and uses two geometric random numbers based on the same probability for a single Bernoulli trial. The differential geometric random number is then the subtraction of the two geometric random numbers, so you can interpret it as trial difference.
In contrast to class Geometric, the distribution function is here given by:
where is the probability for a single Bernoulli trial as stored in Geometric::pMean.
Below you can see the distribution function for the probabilities ,
and
for a single Bernoulli trial:
DiffGeometric::DiffGeometric | ( | double | mean = 0 |
) | [inline] |
Creates a new instance of the differential geometric random number generator and sets the probability for a single Bernoulli trial.
The probability Geometric::pMean for a single Bernoulli trial is set to mean.
For this instance, the default pseudo random number generator as member of class RandomVar is used.
mean | the probability for a single Bernoulli trial, the default is "0" |
DiffGeometric::DiffGeometric | ( | double | mean, | |
RNG & | r | |||
) | [inline] |
Creates a new differential geometric random generator instance by using the pseudo random number generator "r" for the determination of random values and sets the probability for a single Bernoulli trial.
Each instance of a differential geometric 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, the probability Geometric::pMean for a single Bernoulli trial is set to mean.
mean | the probability for a single Bernoulli trial | |
r | the pseudo random number generator that is used |
long DiffGeometric::operator() | ( | double | mean | ) |
For a given probability "mean" for a single Benoulli trial, this method returns a differential geometric random number as difference between two geometric random numbers (trial difference).
For a given probability "mean" for a single Benoulli trial, this method returns a differential geometric random number as difference between two geometric random numbers (trial difference).
Reimplemented from Geometric.
long DiffGeometric::operator() | ( | ) | [virtual] |
For the current probability for a single Benoulli trial stored in Geometric::pMean, this method returns a differential geometric random number as difference between two geometric random numbers (trial difference).
For the current probability for a single Benoulli trial stored in Geometric::pMean, this method returns a differential geometric random number as difference between two geometric random numbers (trial difference).
Reimplemented from Geometric.
double DiffGeometric::p | ( | const long & | x | ) | const [virtual] |
For a value "x" of trial difference, this method returns the probability as given by the distribution function.
For a value "x" of trial difference, this method returns the probability as given by the distribution function.
x | the trial difference |
Reimplemented from Geometric.