-4

JavaScript does not have a seed method for its Math.random() method.

When "intellisensing" JavaScript's Math object in an IDE, there is no indication that a seed method exists.

Does the ECMAScript specification say that a seed will be automatically set?

Perhaps when the first script of an HTML page loads or when a browser is started there is an internal call to seed the RNG.

Sebastian Simon
  • 18,263
  • 7
  • 55
  • 75
Armend Veseli
  • 143
  • 2
  • 9

1 Answers1

2

No. The standard makes virtually no requirements about how Math.random is implemented besides this single paragraph:

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.

See https://262.ecma-international.org/5.1/#sec-15.8.2.14

user229044
  • 232,980
  • 40
  • 330
  • 338