bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#32605: [w64] (random) never returns negative


From: Lars Ingebrigtsen
Subject: bug#32605: [w64] (random) never returns negative
Date: Thu, 12 Aug 2021 15:17:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Andy Moreton <andrewjmoreton@gmail.com> writes:

>> This bug seems specific to 64 bit Windows builds.
>
> ON 64bit Windows, sysdep.c sets RAND_BITS to 31, but random (in w32.c)
> only provides 30 bits. It looks like the mixing in get_random does not
> result in the top fixnum bit being set.

So it's this:

int
random (void)
{
  /* rand_as183 () gives us 15 random bits...hack together 30 bits.  */
  return ((rand_as183 () << 15) | rand_as183 ());
}

So running rand_as183 and taking another bit from that might do the
trick?  Eli, do you have any comments here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]