ns-3
ns3::SeedManager Class Reference

List of all members.

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.

Member Function Documentation

bool ns3::SeedManager::CheckSeed ( uint32_t  seed)
static

Check if seed value is valid if wanted to be used as seed.

Returns:
true if valid and false if invalid
uint32_t ns3::SeedManager::GetRun ( void  )
static
Returns:
the current run number
See also:
SetRun
uint32_t ns3::SeedManager::GetSeed ( )
static

Get the seed value.

Returns:
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.

int N = atol(argv[1]); //read in run number from command line
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

UniformVariable x(2,3); //these will give the same output everytime
ExponentialVariable y(120); //as long as the seed stays the same
Parameters:
seedNote, 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.

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