Manage the seed number and run number of the underlying random number generator, and automatic assignment of stream numbers. More...
#include "rng-seed-manager.h"
Static Public Member Functions | |
static uint64_t | GetNextStreamIndex () |
Get the next automatically assigned stream index. | |
static uint64_t | GetRun () |
Get the current run number. | |
static uint32_t | GetSeed () |
Get the current seed value which will be used by all subsequently instantiated RandomVariableStream objects. | |
static void | SetRun (uint64_t run) |
Set the run number of simulation. | |
static void | SetSeed (uint32_t seed) |
Set the seed. | |
Related Functions | |
(Note that these are not member functions.) | |
static uint64_t | g_nextStreamIndex = 0 |
The next random number generator stream number to use for automatic assignment. | |
static ns3::GlobalValue | g_rngRun ("RngRun", "The substream index used for all streams", ns3::UintegerValue(1), ns3::MakeUintegerChecker< uint64_t >()) |
The random number generator substream index. | |
static ns3::GlobalValue | g_rngSeed ("RngSeed", "The global seed of all rng streams", ns3::UintegerValue(1), ns3::MakeUintegerChecker< uint32_t >()) |
The random number generator seed number global value. | |
Manage the seed number and run number of the underlying random number generator, and automatic assignment of stream numbers.
Definition at line 39 of file rng-seed-manager.h.
|
static |
Get the next automatically assigned stream index.
Definition at line 107 of file rng-seed-manager.cc.
References g_nextStreamIndex, and NS_LOG_FUNCTION_NOARGS.
Referenced by ns3::RandomVariableStream::SetStream().
|
static |
Get the current run number.
Definition at line 97 of file rng-seed-manager.cc.
References g_rngRun, ns3::GlobalValue::GetValue(), and NS_LOG_FUNCTION_NOARGS.
Referenced by LteCellSelectionTestCase::DoRun(), ns3::LenaDeactivateBearerTestCase::DoRun(), LteHandoverFailureTestCase::DoRun(), LteX2HandoverTestCase::DoRun(), OfdmaAckSequenceTest::DoRun(), NetAnimExperiment::IncrementCw(), Experiment::IncrementCw(), ns3::RandomVariableStream::SetStream(), and ns3::test::RandomVariable::TestCaseBase::SetTestSuiteSeed().
|
static |
Get the current seed value which will be used by all subsequently instantiated RandomVariableStream objects.
This returns the current seed value.
Definition at line 74 of file rng-seed-manager.cc.
References g_rngSeed, ns3::UintegerValue::Get(), ns3::GlobalValue::GetValue(), and NS_LOG_FUNCTION_NOARGS.
Referenced by LteCellSelectionTestCase::DoRun(), ns3::LenaDeactivateBearerTestCase::DoRun(), LteHandoverFailureTestCase::DoRun(), LteX2HandoverTestCase::DoRun(), OfdmaAckSequenceTest::DoRun(), ns3::RandomVariableStream::SetStream(), and ns3::test::RandomVariable::TestCaseBase::SetTestSuiteSeed().
|
static |
Set the run number of simulation.
In this example, N
could successively be equal to 1,2,3, etc. and the user would continue to get independent runs out of the single simulation. For this simple example, the following might work:
[in] | run | The run number. |
Definition at line 90 of file rng-seed-manager.cc.
References NS_LOG_FUNCTION, and ns3::Config::SetGlobal().
Referenced by ChainRegressionTest::DoRun(), Bug772ChainTest::DoRun(), BriteTopologyStructureTestCase::DoRun(), ThreeGppV2vBuildingsChCondModelTestCase::DoRun(), ThreeGppV2vUrbanLosNlosvChCondModelTestCase::DoRun(), ThreeGppV2vHighwayLosNlosvChCondModelTestCase::DoRun(), LrWpanAckTestCase::DoRun(), LrWpanCcaTestCase::DoRun(), LrWpanEdTestCase::DoRun(), LrWpanErrorDistanceTestCase::DoRun(), ns3::LenaDeactivateBearerTestCase::DoRun(), LteHandoverFailureTestCase::DoRun(), LteX2HandoverTestCase::DoRun(), HwmpProactiveRegressionTest::DoRun(), HwmpReactiveRegressionTest::DoRun(), HwmpSimplestRegressionTest::DoRun(), HwmpDoRfRegressionTest::DoRun(), PeerManagementProtocolRegressionTest::DoRun(), FlameRegressionTest::DoRun(), ErrorModelSimple::DoRun(), BurstErrorModelSimple::DoRun(), ns3::olsr::Bug780Test::DoRun(), ns3::olsr::HelloRegressionTest::DoRun(), ns3::olsr::TcRegressionTest::DoRun(), V2vUrbanProbChCondModelTestCase::DoRun(), V2vHighwayProbChCondModelTestCase::DoRun(), Issue211Test::DoRun(), WifiChannelSwitchingTest::DoRun(), WifiUseAvailBwTest::DoRun(), TestNonHtDuplicatePhyReception::DoRun(), TestUlOfdmaPpduUid::DoRun(), TestMultipleHeTbPreambles::DoRun(), TestThresholdPreambleDetectionWithoutFrameCapture::DoRun(), TestThresholdPreambleDetectionWithFrameCapture::DoRun(), TestSimpleFrameCaptureModel::DoRun(), TestPhyHeadersReception::DoRun(), TestAmpduReception::DoRun(), TestUnsupportedBandwidthReception::DoRun(), DcfImmediateAccessBroadcastTestCase::DoRun(), Bug2222TestCase::DoRun(), Issue169TestCase::DoRun(), IdealRateManagerChannelWidthTest::DoRun(), IdealRateManagerMimoTest::DoRun(), WifiTxopTest::DoRun(), EmlsrOperationsTestBase::DoSetup(), MultiLinkOperationsTestBase::DoSetup(), TestMultipleCtsResponsesFromMuRts::DoSetup(), TestPhyPaddingExclusion::DoSetup(), WifiPrimaryChannelsTest::DoSetup(), NetAnimExperiment::IncrementCw(), Experiment::IncrementCw(), Experiment::Run(), TestInterBssConstantObssPdAlgo::RunOne(), WifiPhyCcaIndicationTest::RunOne(), TestDlOfdmaPhyTransmission::RunOne(), TestDlOfdmaPhyPuncturing::RunOne(), TestUlOfdmaPhyTransmission::RunOne(), TestUlOfdmaPowerControl::RunOne(), Issue40TestCase::RunOne(), Bug2470TestCase::RunSubtest(), and StaWifiMacScanningTestCase::Setup().
|
static |
Set the seed.
This sets the global initial seed which will be used all subsequently instantiated RandomVariableStream objects.
[in] | seed | The seed value to use. |
Definition at line 83 of file rng-seed-manager.cc.
References NS_LOG_FUNCTION, and ns3::Config::SetGlobal().
Referenced by AodvExample::Configure(), TracerouteExample::Configure(), ChainRegressionTest::DoRun(), Bug772ChainTest::DoRun(), BriteTopologyStructureTestCase::DoRun(), ThreeGppV2vBuildingsChCondModelTestCase::DoRun(), ThreeGppV2vUrbanLosNlosvChCondModelTestCase::DoRun(), ThreeGppV2vHighwayLosNlosvChCondModelTestCase::DoRun(), RngUniformTestCase::DoRun(), RngNormalTestCase::DoRun(), RngExponentialTestCase::DoRun(), RngParetoTestCase::DoRun(), LrWpanAckTestCase::DoRun(), LrWpanCcaTestCase::DoRun(), LrWpanEdTestCase::DoRun(), LrWpanErrorDistanceTestCase::DoRun(), ns3::LenaDeactivateBearerTestCase::DoRun(), LteRlcUmE2eTestCase::DoRun(), LteHandoverFailureTestCase::DoRun(), LteX2HandoverTestCase::DoRun(), HwmpProactiveRegressionTest::DoRun(), HwmpReactiveRegressionTest::DoRun(), HwmpSimplestRegressionTest::DoRun(), HwmpDoRfRegressionTest::DoRun(), PeerManagementProtocolRegressionTest::DoRun(), FlameRegressionTest::DoRun(), SteadyStateRandomWaypointTest::DoRun(), ErrorModelSimple::DoRun(), BurstErrorModelSimple::DoRun(), ns3::olsr::Bug780Test::DoRun(), ns3::olsr::HelloRegressionTest::DoRun(), ns3::olsr::TcRegressionTest::DoRun(), V2vUrbanProbChCondModelTestCase::DoRun(), V2vHighwayProbChCondModelTestCase::DoRun(), Issue211Test::DoRun(), WifiChannelSwitchingTest::DoRun(), WifiUseAvailBwTest::DoRun(), TestNonHtDuplicatePhyReception::DoRun(), TestUlOfdmaPpduUid::DoRun(), TestMultipleHeTbPreambles::DoRun(), TestThresholdPreambleDetectionWithoutFrameCapture::DoRun(), TestThresholdPreambleDetectionWithFrameCapture::DoRun(), TestSimpleFrameCaptureModel::DoRun(), TestPhyHeadersReception::DoRun(), TestAmpduReception::DoRun(), TestUnsupportedBandwidthReception::DoRun(), DcfImmediateAccessBroadcastTestCase::DoRun(), Bug2222TestCase::DoRun(), Issue169TestCase::DoRun(), IdealRateManagerChannelWidthTest::DoRun(), IdealRateManagerMimoTest::DoRun(), WifiTxopTest::DoRun(), EmlsrOperationsTestBase::DoSetup(), MultiLinkOperationsTestBase::DoSetup(), TestMultipleCtsResponsesFromMuRts::DoSetup(), TestPhyPaddingExclusion::DoSetup(), WifiPrimaryChannelsTest::DoSetup(), Experiment::Run(), TestInterBssConstantObssPdAlgo::RunOne(), WifiPhyCcaIndicationTest::RunOne(), TestDlOfdmaPhyTransmission::RunOne(), TestDlOfdmaPhyPuncturing::RunOne(), TestUlOfdmaPhyTransmission::RunOne(), TestUlOfdmaPowerControl::RunOne(), Issue40TestCase::RunOne(), Bug2470TestCase::RunSubtest(), ns3::test::RandomVariable::TestCaseBase::SetTestSuiteSeed(), and StaWifiMacScanningTestCase::Setup().
|
related |
The next random number generator stream number to use for automatic assignment.
Definition at line 43 of file rng-seed-manager.cc.
Referenced by GetNextStreamIndex().
|
related |
The random number generator substream index.
This is used to generate new PRNG sequences for all streams (random variables) in such a manner that the streams remain uncorrelated. Incrementing this variable can be used for independent replications.
This is accessible as "--RngRun" from CommandLine.
Referenced by GetRun().
|
related |
The random number generator seed number global value.
This is used to generate an new master PRNG sequence. It is typically not modified by user programs; the variable RngRun is preferred for independent replications.
This is accessible as "--RngSeed" from CommandLine.
Referenced by GetSeed().