[whatwg] Side effects free scripts

liorean liorean at gmail.com
Wed May 31 09:54:42 PDT 2006


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:
>15.8.2.14 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
arguments.


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
<uri:http://liorean.web-graphics.com/>



More information about the whatwg mailing list