Combined Multiple-Recursive Generator MRG32k3a. More...
#include "rng-stream.h"
Public Member Functions | |
RngStream (const RngStream &r) | |
Copy constructor. | |
RngStream (uint32_t seed, uint64_t stream, uint64_t substream) | |
Construct from explicit seed, stream and substream values. | |
double | RandU01 () |
Generate the next random number for this stream. | |
Private Member Functions | |
void | AdvanceNthBy (uint64_t nth, int by, double state[6]) |
Advance state of the RNG by leaps and bounds. | |
Private Attributes | |
double | m_currentState [6] |
The RNG state vector. | |
Combined Multiple-Recursive Generator MRG32k3a.
This class is the combined multiple-recursive random number generator called MRG32k3a. The ns3::RandomVariableBase class holds a static instance of this class. The details of this class are explained in: http://www.iro.umontreal.ca/~lecuyer/myftp/papers/streams00.pdf
Definition at line 49 of file rng-stream.h.
ns3::RngStream::RngStream | ( | uint32_t | seed, |
uint64_t | stream, | ||
uint64_t | substream | ||
) |
Construct from explicit seed, stream and substream values.
[in] | seed | The starting seed. |
[in] | stream | The stream number. |
[in] | substream | The sub-stream number. |
Definition at line 378 of file rng-stream.cc.
References AdvanceNthBy(), MRG32k3a::m1, MRG32k3a::m2, m_currentState, and NS_FATAL_ERROR.
ns3::RngStream::RngStream | ( | const RngStream & | r | ) |
Copy constructor.
[in] | r | The RngStream to copy. |
Definition at line 392 of file rng-stream.cc.
References m_currentState.
|
private |
Advance state of the RNG by leaps and bounds.
[in] | nth | The stream or substream index. |
[in] | by | The log2 base of nth. |
[in] | state | The state vector to advance. |
Definition at line 401 of file rng-stream.cc.
References MRG32k3a::m1, MRG32k3a::m2, MRG32k3a::MatVecModM(), and MRG32k3a::PowerOfTwoMatrix().
Referenced by RngStream().
double ns3::RngStream::RandU01 | ( | ) |
Generate the next random number for this stream.
Uniformly distributed between 0 and 1.
Definition at line 341 of file rng-stream.cc.
References MRG32k3a::a12, MRG32k3a::a13n, MRG32k3a::a21, MRG32k3a::a23n, MRG32k3a::m1, MRG32k3a::m2, m_currentState, and MRG32k3a::norm.
Referenced by ns3::ErlangRandomVariable::GetExponentialValue(), ns3::GammaRandomVariable::GetNormalValue(), ns3::ZetaRandomVariable::GetValue(), ns3::GammaRandomVariable::GetValue(), ns3::ExponentialRandomVariable::GetValue(), ns3::TriangularRandomVariable::GetValue(), ns3::NormalRandomVariable::GetValue(), ns3::UniformRandomVariable::GetValue(), ns3::LogNormalRandomVariable::GetValue(), ns3::ParetoRandomVariable::GetValue(), ns3::WeibullRandomVariable::GetValue(), ns3::ZipfRandomVariable::GetValue(), and ns3::EmpiricalRandomVariable::PreSample().
|
private |
The RNG state vector.
Definition at line 85 of file rng-stream.h.
Referenced by RngStream(), and RandU01().