Socket
Socket
Sign inDemoInstall

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.1 to 3.0.0

10

index.d.ts

@@ -10,13 +10,11 @@ /**

```
import randomInt = require('random-int');
import randomInteger from 'random-int';
randomInt(5);
randomInteger(5);
//=> 3
randomInt(10, 100);
randomInteger(10, 100);
//=> 54
```
*/
declare function randomInt(minimum?: number, maximum?: number): number;
export = randomInt;
export default function randomInteger(minimum?: number, maximum?: number): number;

6

index.js

@@ -1,4 +0,2 @@

'use strict';
module.exports = (minimum, maximum) => {
export default function randomInteger(minimum, maximum) {
if (maximum === undefined) {

@@ -16,2 +14,2 @@ maximum = minimum;

);
};
}
{
"name": "random-int",
"version": "2.0.1",
"version": "3.0.0",
"description": "Generate a random integer",
"license": "MIT",
"repository": "sindresorhus/random-int",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=8"
"node": ">=12"
},

@@ -23,3 +26,2 @@ "scripts": {

"keywords": [
"rand",
"random",

@@ -37,8 +39,8 @@ "randomize",

"devDependencies": {
"ava": "^1.4.1",
"in-range": "^2.0.0",
"stable-fn": "^2.0.0",
"tsd": "^0.7.2",
"xo": "^0.24.0"
"ava": "^3.15.0",
"in-range": "^3.0.0",
"stable-fn": "^3.0.0",
"tsd": "^0.14.0",
"xo": "^0.38.2"
}
}

@@ -1,6 +0,5 @@

# random-int [![Build Status](https://travis-ci.org/sindresorhus/random-int.svg?branch=master)](https://travis-ci.org/sindresorhus/random-int)
# random-int
> Generate a random integer
## Install

@@ -12,23 +11,21 @@

## Usage
```js
const randomInt = require('random-int');
import randomInteger from 'random-int';
randomInt(5);
randomInteger(5);
//=> 3
randomInt(10, 100);
randomInteger(10, 100);
//=> 54
```
## API
### randomInt([maximum])
### randomInteger(maximum?)
Returns an integer from `0` to `maximum`.
### randomInt(minimum, maximum)
### randomInteger(minimum, maximum)

@@ -39,3 +36,3 @@ Returns an integer from `minimum` to `maximum`.

Type: `number`<br>
Type: `number`\
Default: `0`

@@ -47,3 +44,3 @@

Type: `number`<br>
Type: `number`\
Default: `1`

@@ -53,3 +50,2 @@

## Related

@@ -64,6 +60,1 @@

- [crypto-random-string](https://github.com/sindresorhus/crypto-random-string) - Generate a cryptographically strong random string
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

Sorry, the diff of this file is not supported yet

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