diff --git a/src/random/glibc_random_yura.c b/src/random/glibc_random_yura.c index abafac7..faaf75a 100644 --- a/src/random/glibc_random_yura.c +++ b/src/random/glibc_random_yura.c @@ -31,10 +31,12 @@ static inline uint32_t *glibc_fast_nonce(uint32_t seed, uint32_t *dest) /* This does: seed = (16807LL * seed) % 0x7fffffff using the sum of digits method which works for mod N, base N+1 */ - /* Doesn't work for seed = 0x7fffffff or 0xfffffffe */ uint64_t p = 16807ULL * seed; p = (p >> 31) + (p & 0x7fffffff); seed = (p >> 31) + (p & 0x7fffffff); +#if 0 /* Same as PWPS_UNERRING */ + if (seed == 0x7fffffff) seed = 0; +#endif } dest[0] = word0 >> 1; dest[1] = word1 >> 1; @@ -57,10 +59,12 @@ static inline uint32_t glibc_fast_seed(uint32_t seed) /* This does: seed = (16807LL * seed) % 0x7fffffff using the sum of digits method which works for mod N, base N+1 */ - /* Doesn't work for seed = 0x7fffffff or 0xfffffffe */ uint64_t p = 16807ULL * seed; p = (p >> 31) + (p & 0x7fffffff); seed = (p >> 31) + (p & 0x7fffffff); +#if 0 /* Same as PWPS_UNERRING */ + if (seed == 0x7fffffff) seed = 0; +#endif } return (word0 + seed * glibc_seed_tbl[33]) >> 1; }