JavaScript - Math.random () - parameter

What will change the addition of a parameter to Math.random() ?

For instance:

 Math.random() == Math.random(1234) 
+6
source share
6 answers

Math.random does not accept parameters.

If you want to create a random number between two intervals (a and b), you can use the formula:

 math.random()*(ba)+a 
+11
source

Read the specification :

15.8.2.14 random ()

Returns a numeric value with a positive sign greater than or equal to 0, but less than 1, selected randomly or pseudo-randomly with approximately uniform distribution in this range using an implementation-dependent algorithm or strategy. This function does not accept arguments.

+9
source

Nothing. There is no seed in Javascript for Math.random . Everything inside the function call will simply be deleted.

+5
source

There are no official parameters. Take a look here: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/random

The confusion is clear. Some sites have a seed in a function since it appeared in C / Java. More information about this is ignored here: Math.random () - not by accident

If you want the best random number to get from here http://www.random.org/clients/http/ - you will need to wrap it on some client server - see here for more information Ajax request for cross domain from file javascript without server side code

UPDATE: sent a letter to the creator of random.org - he replied that he was working on a jsonp implementation ...

+4
source

It simply ignores the passed parameter.

+3
source

No - Math.random() does not accept any parameters ... :)

+2
source

Source: https://habr.com/ru/post/888300/


All Articles