26 #define RSTEP 1103515245 91 return (themin + (themax - themin) *
next_random());
97 return (themin + (themax - themin) *
last_random());
119 seed = (seed -
themin) / (themax - themin);
120 next =
static_cast<unsigned int>(seed *
RMULT *
RDIVIDE);
130 #ifdef ENABLE_CONSISTENCY_CHECKS 148 : themin(p_min), themax(p_max)
150 if (p_seed < p_min || p_seed > p_max)
151 p_seed = (p_min + p_max) / 2;
void setMax(Real p_max)
resets upper bound for random numbers.
Real max() const
returns upper bound of random numbers.
Random numbers.Class Random provides random Real variables, i.e. a value variable that gives another ...
Real min() const
returns lower bound of random numbers.
unsigned long next
random seed.
Real themax
maximum random number to be returned
Real themin
minimum random number to be returned
void setMin(Real p_min)
resets lower bound for random numbers.
Real next_random()
increases rand seed and returns a pseudo random Real value in [0,1).
Everything should be within this namespace.
Real last_random() const
returns the last used random value in [0,1).
Real last() const
returns last random number or seed for next one.
Random(Real p_min=0, Real p_max=1, Real p_seed=0.5)
default constructor.
void setSeed(Real seed)
resets seed for next random number.
bool isConsistent() const
consistency check.