Math.random()
ES1+Returns a floating-point, pseudo-random number in the range 0 to less than 1.
Syntax
Math.random()Return Value
number
A random number between 0 (inclusive) and 1 (exclusive)
Examples
JavaScript
console.log(Math.random());
// 1부터 10 사이의 정수
console.log(Math.floor(Math.random() * 10) + 1); Output:
// 0.7234567890123456
7