The basic RNG for NS-3.Note: The underlying random number generation method used by NS-3 is the RngStream code by Pierre L'Ecuyer at the University of Montreal. More...
#include <random-variable.h>
Public Member Functions | |
RandomVariable () | |
RandomVariable (const RandomVariable &o) | |
~RandomVariable () | |
uint32_t | GetInteger (void) const |
Returns a random integer integer from the underlying distribution. | |
double | GetValue (void) const |
Returns a random double from the underlying distribution. | |
RandomVariable & | operator= (const RandomVariable &o) |
Protected Member Functions | |
RandomVariable (const RandomVariableBase &variable) | |
RandomVariableBase * | Peek (void) const |
Private Attributes | |
RandomVariableBase * | m_variable |
Friends | |
std::ostream & | operator<< (std::ostream &os, const RandomVariable &var) |
std::istream & | operator>> (std::istream &os, RandomVariable &var) |
The basic RNG for NS-3.
Note: The underlying random number generation method used by NS-3 is the RngStream code by Pierre L'Ecuyer at the University of Montreal.
NS-3 has a rich set of random number generators. Class RandomVariable defines the base class functionalty required for all random number generators. By default, the underlying generator is seeded all the time with the same seed value and run number coming from the ns3::GlobalValue RngSeed and RngRun.
Definition at line 60 of file random-variable.h.
ns3::RandomVariable::RandomVariable | ( | ) |
Definition at line 109 of file random-variable.cc.
References NS_LOG_FUNCTION.
ns3::RandomVariable::RandomVariable | ( | const RandomVariable & | o | ) |
Definition at line 114 of file random-variable.cc.
ns3::RandomVariable::~RandomVariable | ( | ) |
Definition at line 133 of file random-variable.cc.
References m_variable, and NS_LOG_FUNCTION.
|
protected |
Definition at line 118 of file random-variable.cc.
uint32_t ns3::RandomVariable::GetInteger | ( | void | ) | const |
Returns a random integer integer from the underlying distribution.
Definition at line 146 of file random-variable.cc.
References ns3::RandomVariableBase::GetInteger(), m_variable, and NS_LOG_FUNCTION.
double ns3::RandomVariable::GetValue | ( | void | ) | const |
Returns a random double from the underlying distribution.
Reimplemented in ns3::ErlangVariable, ns3::GammaVariable, and ns3::UniformVariable.
Definition at line 139 of file random-variable.cc.
References ns3::RandomVariableBase::GetValue(), m_variable, and NS_LOG_FUNCTION.
Referenced by RngNormalTestCase::ChiSquaredTest(), RngExponentialTestCase::ChiSquaredTest(), RngParetoTestCase::ChiSquaredTest(), BasicRandomNumberTestCase::DoRun(), ns3::SequentialVariableImpl::GetValue(), ns3::GammaVariableImpl::GetValue(), and ns3::ErlangVariableImpl::GetValue().
RandomVariable & ns3::RandomVariable::operator= | ( | const RandomVariable & | o | ) |
Definition at line 123 of file random-variable.cc.
References ns3::RandomVariableBase::Copy(), and m_variable.
|
protected |
Definition at line 153 of file random-variable.cc.
References m_variable, and NS_LOG_FUNCTION.
Referenced by ns3::EmpiricalVariable::CDF(), ns3::UniformVariable::GetValue(), ns3::GammaVariable::GetValue(), ns3::ErlangVariable::GetValue(), and ns3::operator<<().
|
friend |
Definition at line 2033 of file random-variable.cc.
|
friend |
Definition at line 2063 of file random-variable.cc.
|
private |
Definition at line 84 of file random-variable.h.
Referenced by GetInteger(), GetValue(), operator=(), Peek(), and ~RandomVariable().