Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #34934

Re: Will Math.random return 0.0?

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Will Math.random return 0.0?
Date 2016-07-17 08:00 +0000
Organization A noiseless patient Spider
Message-ID <nmfdu6$m6e$1@dont-email.me> (permalink)
References <rand-20160716162126@ram.dialup.fu-berlin.de> <nme2i6$81t$1@dont-email.me> <nme4fm$83g$1@dont-email.me> <nme5l0$9ap$1@dont-email.me>

Show all headers | View raw


On Sat, 16 Jul 2016 20:32:32 +0000, Martin Gregorie wrote:

> On Sat, 16 Jul 2016 16:12:30 -0400, Eric Sosman wrote:
> 
>> On 7/16/2016 3:39 PM, Martin Gregorie wrote:
>>> [...]
>>> Meanwhile, your original code had been running for a while before I
>>> developed and played with my extended version and has currently used
>>> 100.5 minutes of MPU time, which is close to 1 hour 40 since its using
>>> between 99 and 100% of the available CPU time from one of the two
>>> cores. This is running on a laptop powered by a 1.6 GHz Core Duo with
>>> 3GB of RAM and running Fedora 23 Linux.
>>>
>>> My billion sample run took 132 seconds to run, or 7.6 million samples
>>> were generated and analysed per second.
>>>
>>> I'll leave your code running to see if it stops any time thus evening.
>> 
>>      Back of the envelope: 2^53 possible numerators (maybe), one of
>> which is all zero.  7.6 million ~= 2^23 samples per second.  Time to
>> cycle through all numerators ~= 2^(53-23) ~= 1E9 seconds, which is just
>> about thirty-four years.  Maybe only half that if we leave out the
>> analysis, so you should have a definite conclusion by 2033 or so.
>> And maybe you'll only need to get half way through the full cycle to
>> hit pay dirt, so I'll pencil you in for, um, 2025.
> 
> Fair enough. Since its 100% use of one core isn't interfering with
> anything else this laptop is doing or eating the battery faster than the
> charger is filling it, I'll leave it running to see if I get lucky.

Killed at 850 m, 14.17 hours. Didn't stop.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Will Math.random return 0.0? Martin Gregorie <martin@address-in-sig.invalid> - 2016-07-16 19:39 +0000
  Re: Will Math.random return 0.0? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-16 16:12 -0400
    Re: Will Math.random return 0.0? Martin Gregorie <martin@address-in-sig.invalid> - 2016-07-16 20:32 +0000
      Re: Will Math.random return 0.0? Martin Gregorie <martin@address-in-sig.invalid> - 2016-07-17 08:00 +0000
    Re: Will Math.random return 0.0? Arne Vajhøj <arne@vajhoej.dk> - 2016-07-16 16:47 -0400
    Re: Will Math.random return 0.0? Marcel Mueller <news.5.maazl@spamgourmet.org> - 2016-07-17 01:03 +0200

csiph-web