Skip to content

Latest commit

 

History

History
30 lines (18 loc) · 702 Bytes

File metadata and controls

30 lines (18 loc) · 702 Bytes

random Range

Return a pseudo-random value within a range of numbers.

Math.randomRange(0, 10)

Returns a pseudo-random number in the range [min, max]; that is, from 0 (inclusive) up to including 1 (inclusive), which you can then scale to your desired range.

Parameters

  • min: the smallest possible pseudo-random number to return.
  • max: the largest possible pseudo-random number to return.

Returns

  • a pseudo-random number between min (inclusive) and max (inclusive).

Example

Generate a random number between 0 and 100.

let centoRandom = Math.randomRange(0, 100);

See Also

random