JavaScript Math

JavaScript Math #

Random number #

Totally random decimal, from 0 (inclusive) to 1 (exclusive):

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

Ref

Random number rounded to an integer:

Math.floor(Math.random() * 10)

^ Changing the multiplier to a lower value can set a ceiling.