Need private packages and team management tools?Check out npm Teams »

random-int

2.0.1 • Public • Published

random-int Build Status

Generate a random integer

Install

$ npm install random-int

Usage

const randomInt = require('random-int');
 
randomInt(5);
//=> 3
 
randomInt(10, 100);
//=> 54

API

randomInt([maximum])

Returns an integer from 0 to maximum.

randomInt(minimum, maximum)

Returns an integer from minimum to maximum.

minimum

Type: number
Default: 0

Minimum integer to return.

maximum

Type: number
Default: 1

Maximum integer to return.

Related

License

MIT © Sindre Sorhus

Install

npm i random-int

DownloadsWeekly Downloads

34,919

Version

2.0.1

License

MIT

Unpacked Size

4.01 kB

Total Files

5

Last publish

Collaborators

  • avatar