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 (MTRand *which=0) |
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, MTRand &rng=myRandomNumberGenerator) |
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 53 of file RandHelper.h.
|
inlinestatic |
Returns a random element from the given vector.
Definition at line 99 of file RandHelper.h.
References rand().
Referenced by MSEdge::getDepartLane().
|
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(), MTRand::hash(), myRandomNumberGenerator, and MTRand::seed().
Referenced by main(), and GUILoadThread::run().
|
static |
Initialises the given options container with random number options.
Definition at line 53 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().
|
inlinestatic |
Returns a random real number in [0, 1)
Definition at line 62 of file RandHelper.h.
References myRandomNumberGenerator, MTRand::randExc(), and SUMOReal.
Referenced by RORouteDef::addAlternative(), RONet::addFlow(), MSBaseVehicle::calculateArrivalPos(), MSInsertionControl::checkFlows(), MSVehicle::checkRewindLinkLanes(), ODMatrix::computeDeparts(), NGRandomNetBuilder::createNet(), NGRandomNetBuilder::createNewNode(), MSCFModel_Kerner::createVehicleVariables(), MSCFModel_Krauss::dawdle(), MSCFModel_Daniel1::dawdle(), MSCFModel_SmartSK::dawdle(), MSCFModel_KraussOrig1::dawdle(), AGPerson::decide(), AGFreeTime::decideTypeOfTrip(), GUILane::drawGL(), MSDevice::equippedByDefaultAssignmentOptions(), MSCFModel_PWag2009::followSpeed(), AGHousehold::generateCars(), AGWorkPosition::generateClosingTime(), AGWorkPosition::generateOpeningTime(), AGCity::generatePopulation(), AGActivities::generateRandomTraffic(), RandomDistributor< SUMOVTypeParameter * >::get(), AGDataAndStatistics::getInverseExpRandomValue(), AGDataAndStatistics::getPoissonsNumberOfChildren(), AGDataAndStatistics::getRandom(), AGDataAndStatistics::getRandomCityGateByIncoming(), AGDataAndStatistics::getRandomCityGateByOutgoing(), getRandomFrom(), AGDataAndStatistics::getRandomPopDistributed(), AGCity::getRandomStreet(), MSLane::insertVehicle(), MSEdge::insertVehicle(), MSCFModel_Kerner::moveHelper(), MSTriggeredRerouter::notifyEnter(), TNeighbourDistribution::num(), rand(), AGAdult::randomFreeWorkPosition(), AGPosition::randomPositionInStreet(), AGActivity::randomTimeBetween(), NGNet::toNB(), MSCFModel_SmartSK::updateMyHeadway(), and MSPModel_Striping::PState::walk().
Returns a random real number in [0, maxV)
Definition at line 67 of file RandHelper.h.
References rand().
Returns a random real number in [minV, maxV)
Definition at line 72 of file RandHelper.h.
References rand().
|
inlinestatic |
Returns a random integer in [0, maxV-1].
Definition at line 77 of file RandHelper.h.
References myRandomNumberGenerator, and MTRand::randInt().
Returns a random integer in [0, maxV-1].
Definition at line 82 of file RandHelper.h.
References myRandomNumberGenerator, and MTRand::randInt().
Returns a random integer in [minV, maxV-1].
Definition at line 87 of file RandHelper.h.
References rand().
|
inlinestatic |
Access to a random number from a normal distribution.
Definition at line 92 of file RandHelper.h.
References SUMOReal.
Referenced by MSCFModel_Wiedemann::_v(), MSVehicleType::computeChosenSpeedDeviation(), and AGActivityGen::varDepTime().
|
staticprotected |
the random number generator to use
Definition at line 107 of file RandHelper.h.
Referenced by initRandGlobal(), and rand().