 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
34 #ifdef DEBUG_RANDCALLS
35 std::map<std::mt19937*, int> RandHelper::myCallCount;
36 std::map<std::mt19937*, int> RandHelper::myRngId;
37 int RandHelper::myDebugIndex(7);
52 oc.
addDescription(
"random",
"Random Number",
"Initialises the random number generator with the current system time");
56 oc.
addDescription(
"seed",
"Random Number",
"Initialises the random number generator with the given value");
62 if (which ==
nullptr) {
65 #ifdef DEBUG_RANDCALLS
66 myRngId[which] = myRngId.size();
69 which->seed((
unsigned long)time(
nullptr));
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static OptionsCont & getOptions()
Retrieves the options.
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
A storage for options typed value containers)
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
static void initRandGlobal(std::mt19937 *which=0)
Reads the given random number options and initialises the random number generator in accordance.
static std::mt19937 myRandomNumberGenerator
the random number generator to use
static void insertRandOptions()
Initialises the given options container with random number options.
static void initRand(std::mt19937 *which=0, const bool random=false, const int seed=23423)
Initialises the random number generator with hardware randomness or seed.