OMNeT++ Simulation Library
5.6.1
|
Random variate generators for discrete distributions.
Classes | |
class | cIntUniform |
Generates random numbers from the discrete uniform distribution. More... | |
class | cIntUniformExcl |
Generates random numbers from the discrete uniform distribution. More... | |
class | cBernoulli |
Generates random numbers that are the results of Bernoulli trials. More... | |
class | cBinomial |
Generates random numbers from the binomial distribution. More... | |
class | cGeometric |
Generates random numbers from the geometric distribution. More... | |
class | cNegBinomial |
Generates random numbers from the negative binomial distribution. More... | |
class | cPoisson |
Generates random numbers from the Poisson distribution. More... | |
Functions | |
SIM_API int | intuniform (cRNG *rng, int a, int b) |
Returns a random integer with uniform distribution in the range [a,b], inclusive. (Note that the function can also return b.) More... | |
SIM_API int | intuniformexcl (cRNG *rng, int a, int b) |
Returns a random integer with uniform distribution over [a,b), that is, from [a,b-1]. More... | |
int | bernoulli (cRNG *rng, double p) |
Returns the result of a Bernoulli trial with probability p, that is, 1 with probability p and 0 with probability (1-p). More... | |
SIM_API int | binomial (cRNG *rng, int n, double p) |
Returns a random integer from the binomial distribution with parameters n and p, that is, the number of successes in n independent trials with probability p. More... | |
SIM_API int | geometric (cRNG *rng, double p) |
Returns a random integer from the geometric distribution with parameter p, that is, the number of independent trials with probability p until the first success. More... | |
SIM_API int | negbinomial (cRNG *rng, int n, double p) |
Returns a random integer from the negative binomial distribution with parameters n and p, that is, the number of failures occurring before n successes in independent trials with probability p of success. More... | |
SIM_API int | poisson (cRNG *rng, double lambda) |
Returns a random integer from the Poisson distribution with parameter lambda, that is, the number of arrivals over unit time where the time between successive arrivals follow exponential distribution with parameter lambda. More... | |
SIM_API int omnetpp::intuniform | ( | cRNG * | rng, |
int | a, | ||
int | b | ||
) |
Returns a random integer with uniform distribution in the range [a,b], inclusive. (Note that the function can also return b.)
a,b | the interval, a<b |
rng | the underlying random number generator |
Referenced by cComponent::intuniform(), and omnetpp::lognormal().
SIM_API int omnetpp::intuniformexcl | ( | cRNG * | rng, |
int | a, | ||
int | b | ||
) |
Returns a random integer with uniform distribution over [a,b), that is, from [a,b-1].
a,b | the interval, a<b |
rng | the underlying random number generator |
Referenced by cComponent::intuniformexcl(), and omnetpp::lognormal().
|
inline |
Returns the result of a Bernoulli trial with probability p, that is, 1 with probability p and 0 with probability (1-p).
Generation is using elementary look-up.
p | 0=<p<=1 |
rng | the underlying random number generator |
References omnetpp::binomial(), cRNG::doubleRand(), omnetpp::geometric(), omnetpp::negbinomial(), and omnetpp::poisson().
Referenced by cComponent::bernoulli().
SIM_API int omnetpp::binomial | ( | cRNG * | rng, |
int | n, | ||
double | p | ||
) |
Returns a random integer from the binomial distribution with parameters n and p, that is, the number of successes in n independent trials with probability p.
Generation is using the relationship to Bernoulli distribution (runtime is proportional to n).
n | n>=0 |
p | 0<=p<=1 |
rng | the underlying random number generator |
Referenced by omnetpp::bernoulli(), and cComponent::binomial().
SIM_API int omnetpp::geometric | ( | cRNG * | rng, |
double | p | ||
) |
Returns a random integer from the geometric distribution with parameter p, that is, the number of independent trials with probability p until the first success.
This is the n=1 special case of the negative binomial distribution.
Generation uses inverse transform.
p | 0<p<=1 |
rng | the underlying random number generator |
Referenced by omnetpp::bernoulli(), and cComponent::geometric().
SIM_API int omnetpp::negbinomial | ( | cRNG * | rng, |
int | n, | ||
double | p | ||
) |
Returns a random integer from the negative binomial distribution with parameters n and p, that is, the number of failures occurring before n successes in independent trials with probability p of success.
Generation is using the relationship to geometric distribution (runtime is proportional to n).
n | n>=0 |
p | 0<p<1 |
rng | the underlying random number generator |
Referenced by omnetpp::bernoulli(), and cComponent::negbinomial().
SIM_API int omnetpp::poisson | ( | cRNG * | rng, |
double | lambda | ||
) |
Returns a random integer from the Poisson distribution with parameter lambda, that is, the number of arrivals over unit time where the time between successive arrivals follow exponential distribution with parameter lambda.
Lambda is also the mean (and variance) of the distribution.
Generation method depends on value of lambda:
lambda | > 0 |
rng | the underlying random number generator |
Referenced by omnetpp::bernoulli(), and cComponent::poisson().