ns-3
|
Static Public Member Functions | |
static void | SetSeed (uint32_t seed) |
set the seed it will duplicate the seed value 6 times | |
static uint32_t | GetSeed () |
Get the seed value. | |
static void | SetRun (uint32_t run) |
Set the run number of simulation. | |
static uint32_t | GetRun (void) |
static bool | CheckSeed (uint32_t seed) |
Check if seed value is valid if wanted to be used as seed. |
bool ns3::SeedManager::CheckSeed | ( | uint32_t | seed | ) | [static] |
Check if seed value is valid if wanted to be used as seed.
uint32_t ns3::SeedManager::GetRun | ( | void | ) | [static] |
uint32_t ns3::SeedManager::GetSeed | ( | ) | [static] |
Get the seed value.
Note: returns the first of the six seed values used in the underlying RNG
References NS_ASSERT.
void ns3::SeedManager::SetRun | ( | uint32_t | run | ) | [static] |
Set the run number of simulation.
SeedManager::SetSeed(12); int N = atol(argv[1]); //read in run number from command line SeedManager::SetRun(N); UniformVariable x(0,10); ExponentialVariable y(2902);
In this example, N could successivly 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:
./simulation 0 ...Results for run 0:... ./simulation 1 ...Results for run 1:...
void ns3::SeedManager::SetSeed | ( | uint32_t | seed | ) | [static] |
set the seed it will duplicate the seed value 6 times
SeedManger::SetSeed(15); UniformVariable x(2,3); //these will give the same output everytime ExponentialVariable y(120); //as long as the seed stays the same
seed | Note, while the underlying RNG takes six integer values as a seed; it is sufficient to set these all to the same integer, so we provide a simpler interface here that just takes one integer. |