83 seed = (1812433253UL * (
seed ^ (
seed >> 30)) + pos + 1) & 0xffffffffUL;
91#define MATRIX_A 0x9908b0dfUL
92#define UPPER_MASK 0x80000000UL
93#define LOWER_MASK 0x7fffffffUL
104 for (i = 0; i <
N -
M; i++) {
108 for (; i <
N - 1; i++) {
117 y = state->
key[state->
pos++];
121 y ^= (y << 7) & 0x9d2c5680UL;
122 y ^= (y << 15) & 0xefc60000UL;
130#if ULONG_MAX <= 0xffffffffUL
140 unsigned long mask = max, value;
151#if ULONG_MAX > 0xffffffffUL
156#if ULONG_MAX > 0xffffffffUL
157 if (max <= 0xffffffffUL) {
158 while ((value = (
rk_random(state) & mask)) > max);
161 while ((value = (
rk_ulong(state) & mask)) > max);
164 while ((value = (
rk_ulong(state) & mask)) > max);
unsigned long rk_interval(unsigned long max, rk_state *state)
static unsigned long rk_ulong(rk_state *state)
returns a random unsigned long between 0 and ULONG_MAX inclusive
void rk_seed(unsigned long seed, rk_state *state)
unsigned long rk_random(rk_state *state)
unsigned long key[RK_STATE_LEN]