July 1998
Intermediate to advanced
1456 pages
65h 5m
English
random() — NN 2 IE J1 ECMA 1
Returns a random number between and 1. To calculate a random integer between zero and another maximum value, use the formula:
Math.round(Math.random() * n)where n is the top integer of the
acceptable range. To calculate a random integer between a range
starting with a number other than zero, use the formula:
Math.round(Math.random() *n) +m
where m is the lowest integer of the
acceptable range and
n+m equals the
maximum value of the range. Note that the
Math.random() method does not work in the Windows
and Macintosh versions of Navigator 2.
Number from 0 through 1.
None.
Read now
Unlock full access