Erlang Distributed Random VariableErlangVariable defines a random variable with Erlang distribution. More...
#include <random-variable.h>
Public Member Functions | |
ErlangVariable () | |
Constructs an Erlang random variable with k = 1 and lambda = 1.0. More... | |
ErlangVariable (unsigned int k, double lambda) | |
double | GetValue (void) const |
call RandomVariable::GetValue More... | |
double | GetValue (unsigned int k, double lambda) const |
Returns an Erlang random distributed double with parameters k and lambda. More... | |
![]() | |
RandomVariable () | |
RandomVariable (const RandomVariable &o) | |
~RandomVariable () | |
uint32_t | GetInteger (void) const |
Returns a random integer integer from the underlying distribution. More... | |
double | GetValue (void) const |
Returns a random double from the underlying distribution. More... | |
RandomVariable & | operator= (const RandomVariable &o) |
Additional Inherited Members | |
![]() | |
RandomVariable (const RandomVariableBase &variable) | |
RandomVariableBase * | Peek (void) const |
Erlang Distributed Random Variable
ErlangVariable defines a random variable with Erlang distribution.
The Erlang distribution is a special case of the Gamma distribution where k (= alpha) is a non-negative integer. Erlang distributed variables can be generated using a much faster algorithm than gamma variables.
This class supports the creation of objects that return random numbers from a fixed Erlang distribution. It also supports the generation of single random numbers from various Erlang distributions.
The probability density function is defined over the interval [0,+inf) as: where
and
Definition at line 624 of file random-variable.h.
ns3::ErlangVariable::ErlangVariable | ( | ) |
Constructs an Erlang random variable with k = 1 and lambda = 1.0.
Definition at line 1732 of file random-variable.cc.
References NS_LOG_FUNCTION.
ns3::ErlangVariable::ErlangVariable | ( | unsigned int | k, |
double | lambda | ||
) |
k | k parameter of the Erlang distribution. Must be a non-negative integer. |
lambda | lambda parameter of the Erlang distribution |
Definition at line 1738 of file random-variable.cc.
References NS_LOG_FUNCTION.
double ns3::ErlangVariable::GetValue | ( | void | ) | const |
Note: we have to re-implement this method here because the method is overloaded below for the two-argument variant and the c++ name resolution rules don't work well with overloads split between parent and child classes.
Definition at line 1744 of file random-variable.cc.
References ns3::RandomVariable::GetValue(), and NS_LOG_FUNCTION.
double ns3::ErlangVariable::GetValue | ( | unsigned int | k, |
double | lambda | ||
) | const |
Returns an Erlang random distributed double with parameters k and lambda.
k | k parameter of the Erlang distribution. Must be a non-negative integer. |
lambda | lambda parameter of the Erlang distribution |
Definition at line 1750 of file random-variable.cc.
References NS_LOG_FUNCTION, and ns3::RandomVariable::Peek().