Socket
Socket
Sign inDemoInstall

random-int

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    random-int

Generate a random integer


Version published
Weekly downloads
189K
decreased by-3.53%
Maintainers
1
Install size
4.86 kB
Created
Weekly downloads
 

Readme

Source

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.

  • random-float - Generate a random float
  • random-item - Get a random item from an array
  • random-obj-key - Get a random key from an object
  • random-obj-prop - Get a random property from an object
  • unique-random - Generate random numbers that are consecutively unique
  • unique-random-array - Get consecutively unique elements from an array
  • crypto-random-string - Generate a cryptographically strong random string

Keywords

FAQs

Last updated on 17 Apr 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc