Math.random

random — Returns a random floating point value between 0 and 1.

Description

Math.random()

Examples

Example #1 – random example
console.log(Math.random()); // A random float between 0 and 1. console.log(Math.random() * 100); // A random float between 0 and 100. console.log(Math.floor(Math.random() * 11)); // A random integer between 0 and 10.

External references