Files
freeCodeCamp/guide/english/javascript/standard-objects/math/math-random/index.md
2018-10-16 21:32:40 +05:30

422 B

title
title
Math Random

Math Random

Math.random() returns a number between 0 (inclusive) and 1 (exclusive).

Syntax

Math.random()

Example

function randomInRange(min, max) {
  return Math.random() * (max - min) + min;
}

More Information:

MDN