What is the use of random method in javascript
This article mainly introduces what is the use of random method in javascript. It is very detailed and has certain reference value. Friends who are interested must finish it!
The javascript random method is used to return a random number between 0 and 1, which uses syntax such as "Math.random ()", and the return value is a pseudo-random number between 0. 0 and 1. 0.
This article operating environment: windows7 system, javascript1.8.5 version, DELL G3 computer.
JavaScript random () method
Definition and usage
The random () method returns a random number between 0 and 1.
Grammar
Math.random ()
Return value
A pseudorandom number between 0.0 and 1.0.
Example
In this example, we will get a random number between 0 and 1:
[xss_clean] (Math.random ())
Output:
0.8187371959444101 is all the content of this article "what is the use of random method in javascript". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!