random-parse
v1.0.3
Published
random parse Float or Int
Downloads
4
Readme
random-float
Generate a random float
Install
$ npm install --save random-parse
Usage
var getRandom = require('random-parse');
var random = new getRandom();
var randomFloat = random.randomFloat;
randomFloat(5);
//=> 4.401887938147411
randomFloat(10, 100);
//=> 72.34217455144972
API
randomFloat(max)
Returns an float from 0
to max
.
randomFloat(min, max)
Returns an float from min
to max
.
min
Type: number
Default: 0
Minimum float to return.
max
Type: number
Default: 1
Maximum float to return.
Related
- random-int - Generate a random integer
- random-item - Get a random item from an array
- random-boolean - Get a random boolean
- 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
random-int
Generate a random integer
Usage
var randomInt = random.randomInt;
randomInt(5);
//=> 3
randomInt(10, 100);
//=> 54
API
randomInt(max)
Returns an integer from 0
to max
.
randomInt(min, max)
Returns an integer from min
to max
.
min
Type: number
Default: 0
Minimum integer to return.
max
Type: number
Default: 1
Maximum integer to return.
Related
- 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
License
MIT © Sindre Sorhus