30 #define DEFAULT_LIN UINT32_C(123456789) 31 #define DEFAULT_XOR UINT32_C(362436000) 32 #define DEFAULT_MWC UINT32_C(521288629) 33 #define DEFAULT_CST UINT32_C(7654321) 36 #define RSTEP UINT64_C(1103515245) 37 #define RADD UINT64_C(12345) 79 lin_seed = (uint32_t)(lin_seed *
RSTEP +
RADD);
82 xor_seed ^= (xor_seed << 13);
83 xor_seed ^= (xor_seed >> 17);
84 xor_seed ^= (xor_seed << 5);
87 t = UINT64_C(698769069) * mwc_seed +
cst_seed;
88 cst_seed = (uint32_t)(t >> 32);
89 mwc_seed = (uint32_t) t;
91 return (lin_seed + xor_seed + mwc_seed) / (
Real)UINT32_MAX;
109 return minimum * (1.0 - randnumber) + maximum * randnumber;
126 seedshift = initshift;
134 assert(lin_seed > 0);
135 assert(xor_seed > 0);
136 assert(mwc_seed > 0);
Random numbers.Class Random provides random Real variables, i.e. a value variable that gives another ...
uint32_t seedshift
initial shift for random seeds.
Real next(Real minimum=0.0, Real maximum=1.0)
returns next random number.
Random(uint32_t randomseed=0)
default constructor.
uint32_t cst_seed
random seed shifted for mwc_seed.
Real next_random()
executes KISS random number generator and returns a pseudo random Real value in [0,1].
Everything should be within this namespace.
uint32_t getSeed() const
returns the initial seed shift
void setSeed(uint32_t initshift)
initialize all seeds of the random number generator.
uint32_t lin_seed
random seed for linear congruential RNS.
uint32_t xor_seed
random seed for XOR-shift RNS.
uint32_t mwc_seed
random seed Multiple-with-carry RNS.