JS: Math. random

By Xah Lee. Date: .
Math.random()

returns a pseudo-random floating-point number between 0 (inclusive) and 1 (exclusive).

console.log(Math.random());
// 0.3325068358456915

console.log(Math.random());
// 0.37657743908498653

console.log(Math.random());
// 0.6655925898838149

How is random number seeded

It's based on current time.

Seed random number

You can't.

JavaScript. math functions.

JavaScript. Random