W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2006

[whatwg] Side effects free scripts

From: liorean <liorean@gmail.com>
Date: Wed, 31 May 2006 18:54:42 +0200
Message-ID: <cee13aa30605310954j64b47dd6p8e34f192e10e4c02@mail.gmail.com>
On 31/05/06, Andrew Fedoniouk <news at terrainformatica.com> wrote:
> ----- Original Message -----
> From: "liorean" <liorean at gmail.com>
> From mathematic standpoint:
> By its definition Math.random() function is not side effect free
> in ECMAScript. It uses static variable for generation of pseudo-number
> sequences.

Well, the ECMAScript spec states:
> random ( )
>Returns a number value with positive sign, greater than or equal to 0
but less than 1, chosen randomly or pseudo randomly with approximately
uniform distribution over that range, using an
implementation-dependent algorithm or strategy. This function takes no

There is nothing in that definition that I find indicates that it has
any side effects. It's all about generating a number, no side effects
are specified or implied.
David "liorean" Andersson
Received on Wednesday, 31 May 2006 09:54:42 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:46 UTC