random-int
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

random-int

Generate a random integer

Install

$ npm install random-int

Usage

import randomInteger from 'random-int';

randomInteger(5);
//=> 3

randomInteger(10, 100);
//=> 54

API

randomInteger(maximum?)

Returns an integer from 0 to maximum.

randomInteger(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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.0.0
    143,991
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 3.0.0
    143,991
  • 2.0.1
    133,391
  • 2.0.0
    3,479
  • 1.0.0
    47,907

Package Sidebar

Install

npm i random-int

Weekly Downloads

167,136

Version

3.0.0

License

MIT

Unpacked Size

3.93 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus