Returns a function that produces a random integer between max (exclusive) and 0 (inclusive)
Use integer if you want a random number directly.
Invoke directly:
integerSource(10)(); // Random number 0-9
Or keep a reference to re-compute:
constr = integerSource(10); r(); // Produce a random integer
If a negative value is given, this is assumed to be the
minimum (inclusive), with 0 as the max (inclusive)
integerSource(-5)(); // Random number from -5 to 0
Specify options for a custom minimum or source of random:
integerSource({ max:5, min:10 })(); // Random number 4-10 integerSource({ max: -5, min: -10 })(); // Random number from -10 to -6 integerSource({ max:10, source:Math.random })(); // Random number between 0-9, with custom source of random
Returns a function that produces a random integer between
max
(exclusive) and 0 (inclusive) Use integer if you want a random number directly.Invoke directly:
Or keep a reference to re-compute:
If a negative value is given, this is assumed to be the minimum (inclusive), with 0 as the max (inclusive)
Specify options for a custom minimum or source of random:
Throws an error if max & min are equal