Generate a random integer
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.editorconfig init Jun 26, 2015
.gitattributes init Jun 26, 2015
.gitignore init Jun 26, 2015
.jshintrc init Jun 26, 2015
.travis.yml init Jun 26, 2015
index.js init Jun 26, 2015
license init Jun 26, 2015
package.json update tests for latest AVA version Dec 31, 2015
readme.md add related module Nov 14, 2016
test.js update tests for latest AVA version Dec 31, 2015

readme.md

random-int Build Status

Generate a random integer

Install

$ npm install --save random-int

Usage

var randomInt = require('random-int');

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

License

MIT © Sindre Sorhus