Fix previous changeset
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
|
||||
|
||||
#include "assert.h"
|
||||
#include "config.h"
|
||||
#include "integer.h"
|
||||
#include "random-variable.h"
|
||||
#include "rng-stream.h"
|
||||
@@ -62,14 +63,12 @@ uint32_t SeedManager::GetSeed()
|
||||
|
||||
void SeedManager::SetSeed(uint32_t seed)
|
||||
{
|
||||
IntegerValue seedValue(seed);
|
||||
g_rngSeed.SetValue(seedValue);
|
||||
Config::SetGlobal("RngSeed", IntegerValue(seed));
|
||||
}
|
||||
|
||||
void SeedManager::SetRun(uint32_t run)
|
||||
{
|
||||
IntegerValue runValue(run);
|
||||
g_rngRun.SetValue(runValue);
|
||||
Config::SetGlobal("RngRun", IntegerValue(run));
|
||||
}
|
||||
|
||||
uint32_t SeedManager::GetRun()
|
||||
|
||||
@@ -201,15 +201,7 @@ void MatPowModM (const double A[3][3], double B[3][3], double m, int32_t n)
|
||||
}
|
||||
}
|
||||
|
||||
static ns3::GlobalValue g_rngSeed ("RngSeed",
|
||||
"The global seed of all rng streams",
|
||||
(getenv ("NS_RNG") !=0) ? GetSeedFromEnv() : ns3::IntegerValue (1),
|
||||
ns3::MakeIntegerChecker<uint32_t> ());
|
||||
static ns3::GlobalValue g_rngRun ("RngRun",
|
||||
"The run number used to modify the global seed",
|
||||
(getenv ("NS_RNG") !=0) ? GetRunFromEnv() : ns3::IntegerValue (1),
|
||||
ns3::MakeIntegerChecker<uint32_t> ());
|
||||
|
||||
//two seeding methods follow
|
||||
ns3::IntegerValue GetSeedFromEnv ()
|
||||
{
|
||||
uint32_t seed;
|
||||
@@ -254,6 +246,15 @@ ns3::IntegerValue GetRunFromEnv ()
|
||||
return run;
|
||||
}
|
||||
|
||||
static ns3::GlobalValue g_rngSeed ("RngSeed",
|
||||
"The global seed of all rng streams",
|
||||
(getenv ("NS_RNG") !=0) ? GetSeedFromEnv() : ns3::IntegerValue (1),
|
||||
ns3::MakeIntegerChecker<uint32_t> ());
|
||||
static ns3::GlobalValue g_rngRun ("RngRun",
|
||||
"The run number used to modify the global seed",
|
||||
(getenv ("NS_RNG") !=0) ? GetRunFromEnv() : ns3::IntegerValue (1),
|
||||
ns3::MakeIntegerChecker<uint32_t> ());
|
||||
|
||||
} // end of anonymous namespace
|
||||
|
||||
|
||||
@@ -425,11 +426,11 @@ RngStream::RngStream ()
|
||||
{
|
||||
g_rngSeed.GetValue (tmp);
|
||||
SetPackageSeed (tmp.Get());
|
||||
initialized = true;
|
||||
globalSeedInitialized = true;
|
||||
}
|
||||
//get the global run number
|
||||
g_rngRun.GetValue (value);
|
||||
uint32_t run = value.Get ();
|
||||
g_rngRun.GetValue (tmp);
|
||||
uint32_t run = tmp.Get ();
|
||||
|
||||
anti = false;
|
||||
incPrec = false;
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
#ifdef RUN_SELF_TESTS
|
||||
uint32_t rngSeed[6] = {1,2,3,4,5,6};
|
||||
ns3::SeedManager::SetSeed(rngSeed);
|
||||
ns3::PacketMetadata::Enable ();
|
||||
ns3::TestManager::EnableVerbose ();
|
||||
bool success = ns3::TestManager::RunTests ();
|
||||
|
||||
Reference in New Issue
Block a user