Random

class Random

Define and collect ways to generate random values and values from random distributions.

Of particular use when encountering MathML defined by the ‘Distributions’ SBML L3 package.

Public Functions

Random(class ModelGeneratorContext &ctx)

creates a new Random object and adds the distrib as global mappings to the execution engine.

Random(const Random &other)

copy constructor, copy the distributions but reset the RNG to what is specified by the config.

Random &operator=(const Random &rhs)

assignment operator, copies the fields from the other object, but does not re-intialize them.

Random()

default ctor, this obviously does not add any mappings to a ModelGeneratorContext.

This would be used when a Random is created by itself, to use the attached RNG engine.

~Random()
double operator()()

return a normalized random number between 0 and 1 using the RNG engine.

int getMaxTries() const

Returns the maximum number of tries to find a value inside a truncated range.

void setMaxTries(int maxTries)

Sets the maximum number of tries to find a value inside a truncated range.

inline double min()

min random number.

MSVC looks at this, but gcc stdlib assumes normalized dist.

inline double max()

max random number.

MSVC looks at this, but gcc stdlib assumes normalized dist.

void setRandomSeed(int64_t)

Try to hide the RNG, so we can use different RNGs in the future.

set the seed used by the random number generator. This will by definition reset the RNG.

int64_t getRandomSeed()

Try to hide the RNG so we can used different RNGs in the future.

get the seed used by the RNG.

Public Members

cxx11_ns::mt19937 engine

RNG engine.

Private Members

int64_t randomSeed
cxx11_ns::uniform_real<double> normalized_uniform_dist
int mMaxTries

The maximum number of tries to find a value inside a truncated range.