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 #62 received at 32605-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andy Moreton <andrewjmoreton <at> gmail.com>
Cc: 32605-done <at> debbugs.gnu.org
Subject: Re: bug#32605: [w64] (random) never returns negative
Date: Sat, 14 Aug 2021 17:43:09 +0300
> From: Andy Moreton <andrewjmoreton <at> gmail.com>
> Date: Sat, 14 Aug 2021 14:40:35 +0100
> 
> >> On 32bit builds both options are roughly equivalent.
> >> On 64bit builds option (b) is better as option (a) does unnecessary work.
> >
> > The above assumes we will never call 'random' except via 'get_random'.
> > Is that something we want to bet on?
> 
> Option (b) fixes bugs in the current code. Currently 'get_random' is the
> only caller of 'random'.  If inefficiency is a problem after later code
> changes, then then this issue can be revisited.
> 
> Another option is to replace the imlementation of 'random' in w32.c with
> a different PRNG that can generate 31 bits more efficiently than using 3
> calls to 'rand_as183'.
> 
> Yet another possibility is to use 'getrandom' from gnulib instead of all
> of this Windows specific code, but that may bring a fresh set of
> concerns to be considered.

Thanks, I've decided to go with a hybrid approach that doesn't change
how 32-bit builds behaved up to now.




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.