GMP 6.1.0 release candidate available

Vincent Lefevre vincent at vinc17.net
Fri Oct 30 10:05:33 UTC 2015


On 2015-10-30 10:49:57 +0100, paul zimmermann wrote:
> static mp_limb_t
> random_limb (void)
> {
>   /* lrand48() only gives 31 bits */
> #if GMP_NUMB_BITS == 32
>   return lrand48 () + (lrand48 () << 31);

If you want it to be uniformly distributed, you should remove the
case where lrand48() gives 2^31.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the gmp-bugs mailing list