Function Math.randomN
Generate a random number
-
Syntax
Number Math.randomN(Number n )
Generates a pseudo-random number in the interval [0,n]. -
Parameters
Number n- End of interval. Values less than 1 always returns 0
- Return value A pseudo-random number
-
Examples
- To generate a random integer between 0 and 16 inclusive.
Math.randomN(16)
-
Download
Source
Unless otherwise noted all code in the JSLab Standard Library is licensed as GPLv3. See http://www.gnu.org/licenses/gpl.html for the entire license.
