Generate a random integer
$ npm install random-int
import randomInteger from 'random-int';
randomInteger(5);
//=> 3
randomInteger(10, 100);
//=> 54
Returns an integer from 0
to maximum
.
Returns an integer from minimum
to maximum
.
Type: number
Default: 0
Minimum integer to return.
Type: number
Default: 1
Maximum integer to return.
- random-float - Generate a random float
- random-item - Get a random item from an array
- random-obj-key - Get a random key from an object
- random-obj-prop - Get a random property from an object
- unique-random - Generate random numbers that are consecutively unique
- unique-random-array - Get consecutively unique elements from an array
- crypto-random-string - Generate a cryptographically strong random string