random-unified
v4.0.0-canary.0
Published
Generate something random
Downloads
1
Maintainers
Readme
random-unified
Generate/Get something random. Unified version of sindresorhus's random packages.
fork of
- sindresorhus/random-int
- sindresorhus/random-float
- sindresorhus/random-item
- sindresorhus/random-obj-key
- sindresorhus/random-obj-prop
- sindresorhus/unique-random
- sindresorhus/unique-random-array
- sindresorhus/crypto-random-string
Install
$ npm install --save random-int
Usage
var random = require('random-unified');
random.int(5);
//=> 3
random.int(10, 100);
//=> 54
random.float(5);
//=> 4.401887938147411
random.float(10, 100);
//=> 72.34217455144972
random.item(['pony', 'unicorn', 'rainbow']);
//=> 'unicorn'
random.boolean();
//=> true
random.boolean();
//=> false
random.obj_key({foo: true, bar: true});
//=> 'bar'
random.obj_prop({foo: 'pony', bar: 'unicorn'});
//=> 'unicorn'
const rand = random.unique(1, 10);
console.log(rand(), rand(), rand());
//=> 5 2 6
const random = random.unique_array([1, 2, 3, 4]);
console.log(random(), random(), random(), random());
//=> 4 2 1 4
random.crypto(10);
//=> '2cf05d94db'
Original Repository
- random-int
- random-float
- random-item
- random-boolean
- random-obj-key
- random-obj-prop
- unique-random
- unique-random-array
- crypto-random-string
License
MIT © Sindre Sorhus Modified by startergate