From: Szabolcs Nagy Date: Sat, 8 Jun 2013 13:49:12 +0000 (+0000) Subject: prng: make rand_r have 2^32 period instead of 2^31 X-Git-Tag: v0.9.11~35 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0996faa3d789dd69e4c1c022757f0623908b0df5;p=oweals%2Fmusl.git prng: make rand_r have 2^32 period instead of 2^31 this is a minor fix to increase the period of the obsolete rand_r a bit. an include header in __rand48_step.c is fixed as well. --- diff --git a/src/prng/__rand48_step.c b/src/prng/__rand48_step.c index 755b4f2f..105f810f 100644 --- a/src/prng/__rand48_step.c +++ b/src/prng/__rand48_step.c @@ -1,5 +1,5 @@ #include -#include +#include uint64_t __rand48_step(unsigned short *xi, unsigned short *lc) { diff --git a/src/prng/rand_r.c b/src/prng/rand_r.c index e96cfba9..ef26dbde 100644 --- a/src/prng/rand_r.c +++ b/src/prng/rand_r.c @@ -2,5 +2,5 @@ int rand_r(unsigned *seed) { - return (*seed = *seed * 1103515245 + 12345) & 0x7fffffff; + return (*seed = *seed * 1103515245 + 12345)/2; }