Generate Random Integers
JavaScript's Math
module has a built-in random
function.
It can be used to generate random floats between 0 and 1.
If you want integers, though, you're going to have to build your own function.
This function allows you to randomly generate numbers between 0
(inclusive) and max
, a number you specify (exclusive).
Last updated