The JavaScript math random() method is used to get a random number between 0 and 1 where 0 is included and 1 is excluded.
Syntax:
Math.random()
Returns
a random number between 0 (included) and 1 (excluded).
Example:
<!DOCTYPE html> <html> <body> <script> document.writeln(Math.random()); </script> </body> </html>