GNU bug report logs - #32605
[w64] (random) never returns negative

Previous Next

Package: emacs;

Reported by: f.j.wright <at> live.co.uk

Date: Sat, 1 Sep 2018 17:21:01 UTC

Severity: normal

Tags: confirmed

Found in version 26.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #18 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andy Moreton <andrewjmoreton <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#32605: 26.1; (random) never returns negative
Date: Wed, 05 Sep 2018 14:20:48 +0100
On Tue 04 Sep 2018, Noam Postavsky wrote:

> retitle 32605 [w64] (random) never returns negative
> tags 32605 + confirmed
> quit
>
> Stephen Berman <stephen.berman <at> gmx.net> writes:
>
>> On Sat, 01 Sep 2018 18:18:01 +0100 Francis Wright <francis.j.wright <at> gmail.com> wrote:
>>> Therefore, it should return a negative integer
>>> half the time, but I have never yet seen it return a negative value.
>
>>> In GNU Emacs 26.1 (build 1, x86_64-w64-mingw32)
>
>> Prompted by this report, I just ran `M-: (random)' twice, with these
>> results:
>>
>> 1407814790132564328 (#o116114401367331100550, #x13899017bb648168)
>> -5902216973509885 (#o-247600437205762375, #x-14f808fa17e4fd)
>>
>> This was on a build from current master under GNU/Linux
>
> 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.

    AndyM





This bug report was last modified 4 years ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.