SUMO - Simulation of Urban MObility
|
Utility functions for using a global, resetable random number generator. More...
#include <RandHelper.h>
Static Public Member Functions | |
template<class T > | |
static T | getRandomFrom (const std::vector< T > &v) |
Returns a random element from the given vector. | |
static void | initRandGlobal () |
Reads the given random number options and initialises the random number generator in accordance. | |
static void | insertRandOptions () |
Initialises the given options container with random number options. | |
static SUMOReal | rand () |
Returns a random real number in [0, 1) | |
static SUMOReal | rand (SUMOReal maxV) |
Returns a random real number in [0, maxV) | |
static SUMOReal | rand (SUMOReal minV, SUMOReal maxV) |
Returns a random real number in [minV, maxV) | |
static size_t | rand (size_t maxV) |
Returns a random integer in [0, maxV-1]. | |
static int | rand (int maxV) |
Returns a random integer in [0, maxV-1]. | |
static int | rand (int minV, int maxV) |
Returns a random integer in [minV, maxV-1]. | |
static SUMOReal | randNorm (SUMOReal mean, SUMOReal variance) |
Access to a random number from a normal distribution. | |
Static Protected Attributes | |
static MTRand | myRandomNumberGenerator |
the random number generator to use |
Utility functions for using a global, resetable random number generator.
Definition at line 51 of file RandHelper.h.
static T RandHelper::getRandomFrom | ( | const std::vector< T > & | v | ) | [inline, static] |
Returns a random element from the given vector.
Definition at line 97 of file RandHelper.h.
References rand().
Referenced by MSEdge::getDepartLane(), RONet::getRandomDestination(), and RONet::getRandomSource().
void RandHelper::initRandGlobal | ( | ) | [static] |
Reads the given random number options and initialises the random number generator in accordance.
Definition at line 68 of file RandHelper.cpp.
References OptionsCont::getBool(), OptionsCont::getInt(), OptionsCont::getOptions(), myRandomNumberGenerator, and MTRand::seed().
Referenced by main(), and GUILoadThread::run().
void RandHelper::insertRandOptions | ( | ) | [static] |
Initialises the given options container with random number options.
Definition at line 52 of file RandHelper.cpp.
References OptionsCont::addDescription(), OptionsCont::addOptionSubTopic(), OptionsCont::addSynonyme(), OptionsCont::doRegister(), and OptionsCont::getOptions().
Referenced by RODFFrame::fillOptions(), AGFrame::fillOptions(), ROJTRFrame::fillOptions(), RODUAFrame::fillOptions(), fillOptions(), and MSFrame::fillOptions().
static SUMOReal RandHelper::rand | ( | ) | [inline, static] |
Returns a random real number in [0, 1)
Definition at line 60 of file RandHelper.h.
References myRandomNumberGenerator, MTRand::randExc(), and SUMOReal.
Referenced by MSCFModel_Kerner::_v(), RORouteDef_Alternatives::addAlternative(), MSDevice_HBEFA::buildVehicleDevices(), MSDevice_Routing::buildVehicleDevices(), MSBaseVehicle::calculateArrivalPos(), ODMatrix::computeDeparts(), NGRandomNetBuilder::createNet(), NGRandomNetBuilder::createNewNode(), MSCFModel_Krauss::dawdle(), MSCFModel_PWag2009::dawdle(), MSCFModel_KraussOrig1::dawdle(), AGPerson::decide(), AGFreeTime::decideTypeOfTrip(), AGHousehold::decisionProba(), RORDGenerator_ODAmounts::FlowDef::FlowDef(), AGWorkPosition::generateClosingTime(), AGWorkPosition::generateOpeningTime(), AGActivities::generateRandomTraffic(), RandomDistributor< MSVehicleType * >::get(), AGDataAndStatistics::getInverseExpRandomValue(), AGDataAndStatistics::getPoissonsNumberOfChildren(), AGDataAndStatistics::getRandom(), AGDataAndStatistics::getRandomCityGateByIncoming(), AGDataAndStatistics::getRandomCityGateByOutgoing(), getRandomFrom(), AGDataAndStatistics::getRandomPopDistributed(), AGCity::getRandomStreet(), MSLane::insertVehicle(), MSEdge::insertVehicle(), MSCFModel_PWag2009::moveHelper(), MSTriggeredRerouter::notifyEnter(), TNeighbourDistribution::num(), rand(), AGAdult::randomFreeWorkPosition(), AGPosition::randomPositionInStreet(), AGActivity::randomTimeBetween(), and NGNet::toNB().
static SUMOReal RandHelper::rand | ( | SUMOReal | maxV | ) | [inline, static] |
Returns a random real number in [0, maxV)
Definition at line 65 of file RandHelper.h.
References rand().
static SUMOReal RandHelper::rand | ( | SUMOReal | minV, |
SUMOReal | maxV | ||
) | [inline, static] |
Returns a random real number in [minV, maxV)
Definition at line 70 of file RandHelper.h.
References rand().
static size_t RandHelper::rand | ( | size_t | maxV | ) | [inline, static] |
Returns a random integer in [0, maxV-1].
Definition at line 75 of file RandHelper.h.
References myRandomNumberGenerator, and MTRand::randInt().
static int RandHelper::rand | ( | int | maxV | ) | [inline, static] |
Returns a random integer in [0, maxV-1].
Definition at line 80 of file RandHelper.h.
References myRandomNumberGenerator, and MTRand::randInt().
static int RandHelper::rand | ( | int | minV, |
int | maxV | ||
) | [inline, static] |
Returns a random integer in [minV, maxV-1].
Definition at line 85 of file RandHelper.h.
References rand().
static SUMOReal RandHelper::randNorm | ( | SUMOReal | mean, |
SUMOReal | variance | ||
) | [inline, static] |
Access to a random number from a normal distribution.
Definition at line 90 of file RandHelper.h.
References myRandomNumberGenerator, MTRand::randNorm(), and SUMOReal.
Referenced by MSCFModel_Wiedemann::_v(), MSVehicleType::getMaxSpeedWithDeviation(), and AGActivityGen::varDepTime().
MTRand RandHelper::myRandomNumberGenerator [static, protected] |
the random number generator to use
Definition at line 104 of file RandHelper.h.
Referenced by initRandGlobal(), rand(), and randNorm().