Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

random-int

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

random-int - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

9

index.d.ts
/**
Generate a random integer.
@param minimumValue - Minimum integer to return. Default: `0`.
@param maximumValue - Maximum integer to return. Default: `1`.
@returns An integer from `minimumValue` to `maximumValue`.
@param minimum - Minimum integer to return. Default: `0`.
@param maximum - Maximum integer to return. Default: `1`.
@returns An integer from `minimum` to `maximum`.

@@ -19,5 +19,4 @@ @example

*/
declare function randomInt(maximumValue?: number): number;
declare function randomInt(minimumValue: number, maximumValue: number): number;
declare function randomInt(minimum?: number, maximum?: number): number;
export = randomInt;
'use strict';
module.exports = (minimumValue, maximumValue) => {
if (maximumValue === undefined) {
maximumValue = minimumValue;
minimumValue = 0;
module.exports = (minimum, maximum) => {
if (maximum === undefined) {
maximum = minimum;
minimum = 0;
}
if (typeof minimumValue !== 'number' || typeof maximumValue !== 'number') {
if (typeof minimum !== 'number' || typeof maximum !== 'number') {
throw new TypeError('Expected all arguments to be numbers');

@@ -14,4 +14,4 @@ }

return Math.floor(
(Math.random() * (maximumValue - minimumValue + 1)) + minimumValue
(Math.random() * (maximum - minimum + 1)) + minimum
);
};
{
"name": "random-int",
"version": "2.0.0",
"version": "2.0.1",
"description": "Generate a random integer",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -28,13 +28,13 @@ # random-int [![Build Status](https://travis-ci.org/sindresorhus/random-int.svg?branch=master)](https://travis-ci.org/sindresorhus/random-int)

### randomInt([maximumValue])
### randomInt([maximum])
Returns an integer from `0` to `maximumValue`.
Returns an integer from `0` to `maximum`.
### randomInt(minimumValue, maximumValue)
### randomInt(minimum, maximum)
Returns an integer from `minimumValue` to `maximumValue`.
Returns an integer from `minimum` to `maximum`.
#### minimumValue
#### minimum
Type: `number`
Type: `number`<br>
Default: `0`

@@ -44,5 +44,5 @@

#### maximumValue
#### maximum
Type: `number`
Type: `number`<br>
Default: `1`

@@ -49,0 +49,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc