|
RepastHPC
2.3.1
|
Methods for working with random distributions, draws etc. More...
#include <Random.h>
Public Member Functions | |
| void | putGenerator (const std::string &id, NumberGenerator *generator) |
| Puts the named generator into this Random. More... | |
| NumberGenerator * | getGenerator (const std::string &id) |
| Gets the named generator or 0 if the name is not found. More... | |
| boost::mt19937 & | engine () |
| Gets the random number engine from which the distributions are created. More... | |
| double | nextDouble () |
| Gets the current seed. More... | |
| DoubleUniformGenerator | createUniDoubleGenerator (double from, double to) |
| Creates a generator that produces doubles in the range [from, to). More... | |
| IntUniformGenerator | createUniIntGenerator (int from, int to) |
| Creates a generator that produces ints in the range [from, to]. More... | |
| TriangleGenerator | createTriangleGenerator (double lowerBound, double mostLikely, double upperBound) |
| Creates a triangle generator with the specified properties. More... | |
| CauchyGenerator | createCauchyGenerator (double median, double sigma) |
| pdf: p(x) = sigma/(pi*(sigma**2 + (x-median)**2)) More... | |
| ExponentialGenerator | createExponentialGenerator (double lambda) |
| pdf: p(x) = lambda * exp(-lambda * x) More... | |
| NormalGenerator | createNormalGenerator (double mean, double sigma) |
| Creates a normal generator. More... | |
| LogNormalGenerator | createLogNormalGenerator (double mean, double sigma) |
| Produces random numbers with p(x) = 1/(x * normal_sigma * sqrt(2*pi)) * exp( -(log(x)-normal_mean)2 / (2*normal_sigma2) ) for x > 0, where normal_mean = log(mean2/sqrt(sigma2 + mean2)) and normal_sigma = sqrt(log(1 + sigma2/mean2)) | |
Static Public Member Functions | |
| static void | initialize (boost::uint32_t seed) |
| Initialize the Random singleton with the specified seed. More... | |
| static void | initialize (boost::mt19937 generator) |
| Initialize the Random singleton with random number generator. More... | |
| static Random * | instance () |
| Gets the singleton instance of this Random. | |
Protected Member Functions | |
| Random (boost::uint32_t seed) | |
| Random (boost::mt19937 generator) | |
Methods for working with random distributions, draws etc.
| CauchyGenerator repast::Random::createCauchyGenerator | ( | double | median, |
| double | sigma | ||
| ) |
pdf: p(x) = sigma/(pi*(sigma**2 + (x-median)**2))
| median | |
| sigma |
| ExponentialGenerator repast::Random::createExponentialGenerator | ( | double | lambda | ) |
pdf: p(x) = lambda * exp(-lambda * x)
| lambda | must be > 0 |
| NormalGenerator repast::Random::createNormalGenerator | ( | double | mean, |
| double | sigma | ||
| ) |
Creates a normal generator.
pdf: p(x) = 1/sqrt(2*pi*sigma) * exp(- (x-mean)2 / (2*sigma2) )
| TriangleGenerator repast::Random::createTriangleGenerator | ( | double | lowerBound, |
| double | mostLikely, | ||
| double | upperBound | ||
| ) |
Creates a triangle generator with the specified properties.
A TriangleGenerator produces a floating point value x where lowerbound <= x <= upperBound and mostLikely is the most probable value for x.
| lowerBound | the lower bound of the values produced by the generator |
| mostLikely | the most likely value produced by the generator |
| upperBound | the upper bound of the values produced by the generator |
| DoubleUniformGenerator repast::Random::createUniDoubleGenerator | ( | double | from, |
| double | to | ||
| ) |
Creates a generator that produces doubles in the range [from, to).
inclusive of from, exclusive of to.
| from | the range start (inclusive) |
| to | the range end (exclusive) |
| IntUniformGenerator repast::Random::createUniIntGenerator | ( | int | from, |
| int | to | ||
| ) |
Creates a generator that produces ints in the range [from, to].
| from | the range start (inclusive) |
| to | the range end (inclusive) |
|
inline |
Gets the random number engine from which the distributions are created.
| NumberGenerator * repast::Random::getGenerator | ( | const std::string & | id | ) |
Gets the named generator or 0 if the name is not found.
| id | the name of the generator to get |
|
static |
Initialize the Random singleton with random number generator.
| generator | the random number generator |
|
static |
Initialize the Random singleton with the specified seed.
| seed | the seed to initialize the random number generator with. |
| double repast::Random::nextDouble | ( | ) |
Gets the current seed.
boost::uint32_t seed() { return seed; } Gets the next double in the range [0, 1).
| void repast::Random::putGenerator | ( | const std::string & | id, |
| NumberGenerator * | generator | ||
| ) |
1.8.17