Generate randoms things like int, float, items of an array, and more
$ npm install basic-random
const basicRandom = require('basic-random');
const Random = new basicRandom();
Random.randomInt(5)
//=> 2
Random.randomInt(10,100)
//=> 65
Random.randomFloat(5, 10)
//=> 6.849534501223438
Random.randomFloat(0, 5, 3)
//=> 2.395
Returns an integer from 0
to maximum
.
Returns an integer from minimum
to maximum
.
Returns an float from 0
to maximum
.
Returns an float from minimum
to maximum
.
Returns an float from minimum
to maximum
with number of 'decimals' value.
Returns an random item from array
.
Returns count
random items from array
.
Returns an random key from object
.
Returns count
random keys from object
.
Type: number
Default: 0
Minimum integer to return.
Type: number
Default: 1
Maximum integer to return.
Type: number
Default: 15
Number of decimals.
Type: array
Default: undefined
Array which will be used.
Type: number
Default: 1
Number of items you want.