Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: Random numbers Date: Thu, 19 Oct 2017 22:21:43 +0100 Organization: A noiseless patient Spider Lines: 25 Message-ID: <877evqrfyw.fsf@bsb.me.uk> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="4b1892bfb13401ca899c30b0c3b2bf84"; logging-data="21384"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/6Mi9O7wh8RnytQm2yFaV8WZvETh7TQIE=" Cancel-Lock: sha1:U+p3eQ54v72pkzzXLZ9ZrQ42pmA= sha1:oMS9JL4BeVp1CbU4dJIOyN/E1aM= Xref: csiph.com comp.lang.javascript:34146 ram@zedat.fu-berlin.de (Stefan Ram) writes: > ram@zedat.fu-berlin.de (Stefan Ram) writes: >>PS: I do not like this sentence from ECMA-Script: >>"Each Math.random function created for distinct realms >>must produce a distinct sequence of values from >>successive calls." > > My suggestion: > > For every pair of Math.random functions created for distinct > realms, the probability to produce the same sequence of n > bits from successive calls must not be significantly larger > than 1/(2**n). Neither really nails it. Both are satisfied by generating just one sequence, r1, r2, ... but prefixed with a counter: 0, r1, r2, ... then 1, r1, r2, ... and so on. It's hard to capture how "random" something that is usually entirely deterministic should be. I think the best bet is to stick with the obvious intent behind the original wording. -- Ben.