Skip to content

mock-end/random-index

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

random-index

Return a random array-like index.

MIT License

build:? coverage:?

Install

$ npm install --save random-index 

Usage

For more use-cases see the tests

var randomIndex = require('random-index');

// API:
// - randomIndex([options]);

// options
// - min
// - max


randomIndex();     
// => 3561           

randomIndex({ max: 1 });    
// => 1

randomIndex({ min:10, max: 100 });
// => 64   

Note: these min and max are inclusive, so they are included in the range.

This means randomIndex({max: 2}) would return either 0, 1, or 2.

Related

Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please create an issue.

About

Return a random array-like index.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages