A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::RandomVariable Class Reference

The basic RNG for NS-3. More...

#include <random-variable.h>

+ Inheritance diagram for ns3::RandomVariable:
+ Collaboration diagram for ns3::RandomVariable:

Public Member Functions

 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...
 
RandomVariableoperator= (const RandomVariable &o)
 

Protected Member Functions

 RandomVariable (const RandomVariableBase &variable)
 
RandomVariableBasePeek (void) const
 

Private Attributes

RandomVariableBasem_variable
 

Friends

std::ostream & operator<< (std::ostream &os, const RandomVariable &var)
 
std::istream & operator>> (std::istream &os, RandomVariable &var)
 

Detailed Description

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.

Constructor & Destructor Documentation

ns3::RandomVariable::RandomVariable ( )

Definition at line 110 of file random-variable.cc.

References NS_LOG_FUNCTION.

ns3::RandomVariable::RandomVariable ( const RandomVariable o)

Definition at line 115 of file random-variable.cc.

ns3::RandomVariable::~RandomVariable ( )

Definition at line 134 of file random-variable.cc.

References m_variable, and NS_LOG_FUNCTION.

ns3::RandomVariable::RandomVariable ( const RandomVariableBase variable)
protected

Definition at line 119 of file random-variable.cc.

Member Function Documentation

uint32_t ns3::RandomVariable::GetInteger ( void  ) const

Returns a random integer integer from the underlying distribution.

Returns
Integer cast of RandomVariable::GetValue

Definition at line 147 of file random-variable.cc.

References ns3::RandomVariableBase::GetInteger(), m_variable, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

double ns3::RandomVariable::GetValue ( void  ) const
RandomVariable & ns3::RandomVariable::operator= ( const RandomVariable o)

Definition at line 124 of file random-variable.cc.

References ns3::RandomVariableBase::Copy(), and m_variable.

+ Here is the call graph for this function:

RandomVariableBase * ns3::RandomVariable::Peek ( void  ) const
protected

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const RandomVariable var 
)
friend
Todo:
support other distributions

Definition at line 2034 of file random-variable.cc.

std::istream& operator>> ( std::istream &  os,
RandomVariable var 
)
friend
Todo:
support other distributions.

Definition at line 2064 of file random-variable.cc.

Member Data Documentation

RandomVariableBase* ns3::RandomVariable::m_variable
private

Definition at line 84 of file random-variable.h.

Referenced by GetInteger(), GetValue(), operator=(), Peek(), and ~RandomVariable().


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