Skip to content

fatelei/random.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

random.js

Build Status

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.

About

JavaScript random tools

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published