The Random Number Generator (RNG) that allows stream numbers to be set deterministically. More...
#include <random-variable-stream.h>
Public Member Functions | |
RandomVariableStream () | |
virtual | ~RandomVariableStream () |
virtual uint32_t | GetInteger (void)=0 |
Returns a random integer integer from the underlying distribution. More... | |
int64_t | GetStream (void) const |
Returns the stream number for this RNG stream. More... | |
virtual double | GetValue (void)=0 |
Returns a random double from the underlying distribution. More... | |
bool | IsAntithetic (void) const |
Returns true if antithetic values should be generated. More... | |
void | SetAntithetic (bool isAntithetic) |
Specifies whether antithetic values should be generated. More... | |
void | SetStream (int64_t stream) |
Specifies the stream number for this RNG stream. More... | |
![]() | |
Object () | |
virtual | ~Object () |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
Run the DoDispose methods of this object and all the objects aggregated to it. More... | |
AggregateIterator | GetAggregateIterator (void) const |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Initialize (void) |
This method calls the virtual DoInitialize method on all the objects aggregated to this object. More... | |
![]() | |
SimpleRefCount () | |
Constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
![]() | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
![]() | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
![]() | |
static void | Cleanup (void) |
Noop. More... | |
![]() | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Protected Member Functions | |
RngStream * | Peek (void) const |
Returns a pointer to the underlying RNG stream. More... | |
![]() | |
Object (const Object &o) | |
virtual void | DoDispose (void) |
This method is called by Object::Dispose or by the object's destructor, whichever comes first. More... | |
virtual void | DoInitialize (void) |
This method is called only once by Object::Initialize. More... | |
virtual void | NotifyNewAggregate (void) |
This method is invoked whenever two sets of objects are aggregated together. More... | |
![]() | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
This method is invoked once all member attributes have been initialized. More... | |
Private Member Functions | |
RandomVariableStream (const RandomVariableStream &o) | |
RandomVariableStream & | operator= (const RandomVariableStream &o) |
Private Attributes | |
bool | m_isAntithetic |
Indicates if antithetic values should be generated by this RNG stream. More... | |
RngStream * | m_rng |
Pointer to the underlying RNG stream. More... | |
int64_t | m_stream |
The stream number for this RNG stream. More... | |
The Random Number Generator (RNG) that allows stream numbers to be set deterministically.
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 that allow stream numbers to be set deterministically if desired. Class RandomVariableStream defines the base class functionalty required for all such 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. Also by default, the stream number value for this RNG stream is automatically allocated.
ns3::RandomVariableStream is accessible through the following paths with Config::Set and Config::Connect:
No TraceSources are defined for this type.
Definition at line 87 of file random-variable-stream.h.
ns3::RandomVariableStream::RandomVariableStream | ( | ) |
Definition at line 67 of file random-variable-stream.cc.
References NS_LOG_FUNCTION.
|
virtual |
Definition at line 72 of file random-variable-stream.cc.
References m_rng, and NS_LOG_FUNCTION.
|
private |
|
pure virtual |
Returns a random integer integer from the underlying distribution.
Implemented in ns3::EmpiricalRandomVariable, ns3::DeterministicRandomVariable, ns3::ZetaRandomVariable, ns3::ZipfRandomVariable, ns3::TriangularRandomVariable, ns3::ErlangRandomVariable, ns3::GammaRandomVariable, ns3::LogNormalRandomVariable, ns3::NormalRandomVariable, ns3::WeibullRandomVariable, ns3::ParetoRandomVariable, ns3::ExponentialRandomVariable, ns3::SequentialRandomVariable, ns3::ConstantRandomVariable, and ns3::UniformRandomVariable.
Referenced by ns3::BurstErrorModel::DoCorrupt().
int64_t ns3::RandomVariableStream::GetStream | ( | void | ) | const |
Returns the stream number for this RNG stream.
Definition at line 120 of file random-variable-stream.cc.
References m_stream, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
static |
Definition at line 46 of file random-variable-stream.cc.
References GetStream(), IsAntithetic(), SetAntithetic(), ns3::TypeId::SetParent(), and SetStream().
|
pure virtual |
Returns a random double from the underlying distribution.
Implemented in ns3::EmpiricalRandomVariable, ns3::DeterministicRandomVariable, ns3::ZetaRandomVariable, ns3::ZipfRandomVariable, ns3::TriangularRandomVariable, ns3::ErlangRandomVariable, ns3::GammaRandomVariable, ns3::LogNormalRandomVariable, ns3::NormalRandomVariable, ns3::WeibullRandomVariable, ns3::ParetoRandomVariable, ns3::ExponentialRandomVariable, ns3::SequentialRandomVariable, ns3::ConstantRandomVariable, and ns3::UniformRandomVariable.
Referenced by ns3::RandomDirection2dMobilityModel::BeginPause(), ns3::RandomWaypointMobilityModel::BeginWalk(), ns3::BasicEnergyHarvester::CalculateHarvestedPower(), ns3::RandomPropagationLossModel::DoCalcRxPower(), ns3::BurstErrorModel::DoCorrupt(), ns3::RateErrorModel::DoCorruptBit(), ns3::RateErrorModel::DoCorruptByte(), ns3::RateErrorModel::DoCorruptPkt(), ns3::Icmpv6L4Protocol::DoDAD(), ns3::RandomWalk2dMobilityModel::DoInitializePrivate(), ns3::RandomWaypointMobilityModel::DoInitializePrivate(), ns3::RandomPropagationDelayModel::GetDelay(), ns3::RandomRectanglePositionAllocator::GetNext(), ns3::RandomBoxPositionAllocator::GetNext(), ns3::RandomDiscPositionAllocator::GetNext(), ns3::SequentialRandomVariable::GetValue(), Histogramm(), ns3::ArpL3Protocol::Lookup(), ns3::OnOffApplication::ScheduleStartEvent(), ns3::OnOffApplication::ScheduleStopEvent(), ns3::Icmpv6L4Protocol::SendNS(), ns3::Icmpv6L4Protocol::SendRS(), ns3::RandomDirection2dMobilityModel::SetDirectionAndSpeed(), and ns3::GaussMarkovMobilityModel::Start().
bool ns3::RandomVariableStream::IsAntithetic | ( | void | ) | const |
Returns true if antithetic values should be generated.
Definition at line 85 of file random-variable-stream.cc.
References m_isAntithetic, and NS_LOG_FUNCTION.
Referenced by ns3::ErlangRandomVariable::GetExponentialValue(), ns3::GammaRandomVariable::GetNormalValue(), GetTypeId(), ns3::UniformRandomVariable::GetValue(), ns3::ExponentialRandomVariable::GetValue(), ns3::ParetoRandomVariable::GetValue(), ns3::WeibullRandomVariable::GetValue(), ns3::NormalRandomVariable::GetValue(), ns3::LogNormalRandomVariable::GetValue(), ns3::GammaRandomVariable::GetValue(), ns3::TriangularRandomVariable::GetValue(), ns3::ZipfRandomVariable::GetValue(), ns3::ZetaRandomVariable::GetValue(), and ns3::EmpiricalRandomVariable::GetValue().
|
private |
|
protected |
Returns a pointer to the underlying RNG stream.
Definition at line 127 of file random-variable-stream.cc.
References m_rng, and NS_LOG_FUNCTION.
Referenced by ns3::ErlangRandomVariable::GetExponentialValue(), ns3::GammaRandomVariable::GetNormalValue(), ns3::UniformRandomVariable::GetValue(), ns3::ExponentialRandomVariable::GetValue(), ns3::ParetoRandomVariable::GetValue(), ns3::WeibullRandomVariable::GetValue(), ns3::NormalRandomVariable::GetValue(), ns3::LogNormalRandomVariable::GetValue(), ns3::GammaRandomVariable::GetValue(), ns3::TriangularRandomVariable::GetValue(), ns3::ZipfRandomVariable::GetValue(), ns3::ZetaRandomVariable::GetValue(), and ns3::EmpiricalRandomVariable::GetValue().
void ns3::RandomVariableStream::SetAntithetic | ( | bool | isAntithetic | ) |
Specifies whether antithetic values should be generated.
isAntithetic | Set equal to true if antithetic values should be generated by this RNG stream. |
Definition at line 79 of file random-variable-stream.cc.
References m_isAntithetic, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
void ns3::RandomVariableStream::SetStream | ( | int64_t | stream | ) |
Specifies the stream number for this RNG stream.
stream | The stream number for this RNG stream. -1 means "allocate a stream number automatically". |
Definition at line 91 of file random-variable-stream.cc.
References ns3::RngSeedManager::GetNextStreamIndex(), ns3::RngSeedManager::GetRun(), ns3::RngSeedManager::GetSeed(), m_rng, m_stream, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::RandomBuildingPositionAllocator::AssignStreams(), ns3::RandomVariableStreamHelper::AssignStreams(), ns3::RealRandomStream::AssignStreams(), ns3::Radvd::AssignStreams(), ns3::LteUeMac::AssignStreams(), ns3::BriteTopologyHelper::AssignStreams(), ns3::BasicEnergyHarvester::AssignStreams(), ns3::UanMacCw::AssignStreams(), ns3::RandomRoomPositionAllocator::AssignStreams(), ns3::dsdv::RoutingProtocol::AssignStreams(), ns3::dot11s::HwmpProtocol::AssignStreams(), ns3::Backoff::AssignStreams(), ns3::aodv::RoutingProtocol::AssignStreams(), ns3::MinstrelWifiManager::AssignStreams(), ns3::ApWifiMac::AssignStreams(), ns3::ArpL3Protocol::AssignStreams(), ns3::olsr::RoutingProtocol::AssignStreams(), ns3::OnOffApplication::AssignStreams(), ns3::SameRoomPositionAllocator::AssignStreams(), ns3::Ipv6Extension::AssignStreams(), ns3::SixLowPanNetDevice::AssignStreams(), ns3::MeshWifiInterfaceMac::AssignStreams(), ns3::dot11s::PeerManagementProtocol::AssignStreams(), ns3::RedQueue::AssignStreams(), ns3::FixedRoomPositionAllocator::AssignStreams(), ns3::SimpleOfdmWimaxPhy::AssignStreams(), ns3::RandomRectanglePositionAllocator::AssignStreams(), ns3::UanMacRc::AssignStreams(), ns3::RandomBoxPositionAllocator::AssignStreams(), ns3::RipNg::AssignStreams(), ns3::Ipv4GlobalRouting::AssignStreams(), ns3::LrWpanCsmaCa::AssignStreams(), ns3::RateErrorModel::AssignStreams(), ns3::RandomDiscPositionAllocator::AssignStreams(), ns3::UanPhyGen::AssignStreams(), ns3::YansWifiPhy::AssignStreams(), ns3::UniformDiscPositionAllocator::AssignStreams(), ns3::BurstErrorModel::AssignStreams(), ns3::LteSpectrumPhy::AssignStreams(), ns3::Icmpv6L4Protocol::AssignStreams(), ns3::LrWpanPhy::AssignStreams(), ns3::dsr::DsrRouting::AssignStreams(), ns3::JakesPropagationLossModel::DoAssignStreams(), ns3::RandomDirection2dMobilityModel::DoAssignStreams(), ns3::RandomWaypointMobilityModel::DoAssignStreams(), ns3::RandomWalk2dMobilityModel::DoAssignStreams(), ns3::SteadyStateRandomWaypointMobilityModel::DoAssignStreams(), ns3::RandomPropagationDelayModel::DoAssignStreams(), ns3::GaussMarkovMobilityModel::DoAssignStreams(), ns3::RandomPropagationLossModel::DoAssignStreams(), LteX2HandoverTestCase::DoRun(), ErrorModelSimple::DoRun(), LteX2HandoverMeasuresTestCase::DoRun(), BurstErrorModelSimple::DoRun(), GetTypeId(), and main().
|
private |
Indicates if antithetic values should be generated by this RNG stream.
Definition at line 149 of file random-variable-stream.h.
Referenced by IsAntithetic(), and SetAntithetic().
|
private |
Pointer to the underlying RNG stream.
Definition at line 146 of file random-variable-stream.h.
Referenced by Peek(), SetStream(), and ~RandomVariableStream().
|
private |
The stream number for this RNG stream.
Definition at line 152 of file random-variable-stream.h.
Referenced by GetStream(), and SetStream().