ns-3
ns3::ErlangVariable Class Reference

Erlang Distributed Random VariableErlangVariable defines a random variable with Erlang distribution. More...

#include <random-variable.h>

Inheritance diagram for ns3::ErlangVariable:
Collaboration diagram for ns3::ErlangVariable:

List of all members.

Public Member Functions

 ErlangVariable ()
 ErlangVariable (unsigned int k, double lambda)
double GetValue (void) const
 call RandomVariable::GetValue
double GetValue (unsigned int k, double lambda) const
 Returns an Erlang random distributed double with parameters k and lambda.
- Public Member Functions inherited from ns3::RandomVariable
 RandomVariable (const RandomVariable &o)
RandomVariableoperator= (const RandomVariable &o)
uint32_t GetInteger (void) const
 Returns a random integer integer from the underlying distribution.

Additional Inherited Members

- Protected Member Functions inherited from ns3::RandomVariable
 RandomVariable (const RandomVariableBase &variable)
RandomVariableBase * Peek (void) const

Detailed Description

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: $ \frac{x^{k-1} e^{-\frac{x}{\lambda}}}{\lambda^k (k-1)!}$ where $ mean = k \lambda $ and $ variance = k \lambda^2$


Constructor & Destructor Documentation

ns3::ErlangVariable::ErlangVariable ( )

Constructs an Erlang random variable with k = 1 and lambda = 1.0

ns3::ErlangVariable::ErlangVariable ( unsigned int  k,
double  lambda 
)
Parameters:
kk parameter of the Erlang distribution. Must be a non-negative integer.
lambdalambda parameter of the Erlang distribution

Member Function Documentation

double ns3::ErlangVariable::GetValue ( void  ) const

call RandomVariable::GetValue

Returns:
A floating point random value

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.

Reimplemented from ns3::RandomVariable.

double ns3::ErlangVariable::GetValue ( unsigned int  k,
double  lambda 
) const

Returns an Erlang random distributed double with parameters k and lambda.

Parameters:
kk parameter of the Erlang distribution. Must be a non-negative integer.
lambdalambda parameter of the Erlang distribution
Returns:
A floating point random value

The documentation for this class was generated from the following files: