GNU bug report logs -
#32605
[w64] (random) never returns negative
Previous Next
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 #54 received at 32605 <at> debbugs.gnu.org (full text, mbox):
> From: Andy Moreton <andrewjmoreton <at> gmail.com>
> Date: Sat, 14 Aug 2021 13:10:08 +0100
>
> > Why not keep the 30 bits we produce today on 32-bit builds?
>
> For 32bit builds (FIXNUM_BITS is 30), either:
>
> a) define RAND_BITS to 30, 'random' calls 'rand_as183' twice.
> 'get_random' needs 1 call to 'random' (total 2 calls of 'rand_as183').
>
> b) define RAND_BITS to 15, 'random' calls 'rand_as183' once.
> 'get_random' needs 2 calls to 'random' (total 2 calls of 'rand_as183').
>
> For 64bit builds (FIXNUM_BITS is 62), either:
>
> a) define RAND_BITS to 30, 'random' calls 'rand_as183' twice.
> 'get_random' needs 3 calls to 'random' (total 6 calls of 'rand_as183').
>
> b) define RAND_BITS to 15, 'random' calls 'rand_as183' once.
> 'get_random' needs 4 calls to 'random' (total 4 calls of 'rand_as183').
>
> 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?
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.