jsrandom
v0.0.8
Published
JavaScript random tools.
Downloads
9
Readme
random.js
JavaScript random tools
Install
npm install jsrandom
Usage
var random = require('jsrandom');
var arr = [1, 2, 3, 4, 5];
var obj = {
'1': 1,
'2': 2,
'3': 3,
'4': 4
};
console.log(random.randomInt(1, 10));
console.log(random.randomArray(arr));
console.log(random.randomObject(obj));
console.log(random.choice(arr));
Methods
randomInt(min, max)
Generate a random number between min(inclusive) and max(inclusive).
randomArray(arr)
Generate a random order array.
randomObject(obj)
Generate a random object.
choice(arr)
Return a random element from an array.