Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Generate a random integer

License

NotificationsYou must be signed in to change notification settings

sindresorhus/random-int

Generate a random integer

Install

npm install random-int

Usage

importrandomIntegerfrom'random-int';randomInteger(5);//=> 3randomInteger(10,100);//=> 54

API

randomInteger(maximum?)

Returns an integer from0 tomaximum.

randomInteger(minimum, maximum)

Returns an integer fromminimum tomaximum.

Ifminimum is greater thanmaximum, the values are swapped to return an integer from the lower value to the higher value.

minimum

Type:number
Default:0

Minimum integer to return.

maximum

Type:number
Default:1

Maximum integer to return.

Related

About

Generate a random integer

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp