fix rng
This commit is contained in:
parent
6650ad2ad3
commit
04a2ee3f45
@ -19,10 +19,12 @@ volatile long _NONSENSE_VAR = 0;
|
||||
#define CLAMP(X,LB,UB) CLAMP_CEILING(CLAMP_FLOOR(X,LB),UB) // branch-less clamping
|
||||
|
||||
// Random numbers ===
|
||||
#define A (unsigned int)2000000011 // prime
|
||||
#define M (unsigned int)4000000007 // prime
|
||||
#define C (unsigned int)1283612343
|
||||
static unsigned int rng_seed = 2345745;
|
||||
// glibc
|
||||
// https://en.wikipedia.org/wiki/Linear_congruential_generator
|
||||
#define A 1103515245ull
|
||||
#define M 0x80000000ull
|
||||
#define C 12345ull
|
||||
static unsigned long long rng_seed = 2345745ull;
|
||||
#define RNG rng_seed+=((A*((rng_seed+=C)-C)+C) % M)
|
||||
#define RNG_FROM(X) ((A*X+C) % M)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user