Returns a pseudorandom number between 0 and 1.
SyntaxMath.random( )
Examples
Math.random();
Math.random();
Math.random();
Remarks
The pseudo-random number generated is from 0 (inclusive) to 1 (exclusive), that is, the returned number can be zero, but it will always be less than one. The random number generator is seeded automatically when JavaScript is first loaded.
Due to the nature of the generation methods, these pseudo-random numbers are not uniformly distributed. They are normally distributed which means that, in general, a number is more likely to be closer to 0.5 than 0 or 1.
Note that this method is unsuitable for cryptography. The WebCrypto API addresses this.
See also Other articles AttributionsMicrosoft Developer Network: Windows Internet Explorer JavaScript reference Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4