Mercurial > octave
changeset 27857:81ada4b7d85b
Backed out changeset b3a03dbde858 (uniform spacing of doubles).
author | Rik <rik@octave.org> |
---|---|
date | Fri, 20 Dec 2019 14:25:16 -0800 |
parents | b3a03dbde858 |
children | 797be8d10c22 |
files | liboctave/numeric/randmtzig.cc |
diffstat | 1 files changed, 3 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/numeric/randmtzig.cc Thu Dec 19 12:19:30 2019 -0800 +++ b/liboctave/numeric/randmtzig.cc Fri Dec 20 14:25:16 2019 -0800 @@ -393,15 +393,9 @@ /* generates a random number on (0,1) with 53-bit resolution */ static double randu53 (void) { - uint64_t i; - - do - { - i = randi53 (); - } - while (i == 0); - - return i * (1.0 / 9007199254740992.0); + const uint32_t a = randi32 () >> 5; + const uint32_t b = randi32 () >> 6; + return (a*67108864.0+b+0.4) * (1.0/9007199254740992.0); } /* Determine mantissa for uniform doubles */