# random-integral

> Return a random integer.

Latest version **1.0.3** (published 2016-04-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install random-integral
pnpm add random-integral
yarn add random-integral
bun add random-integral
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2016-04-25 |
| First published | 2016-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | bubkoo |
| Maintainers | bubkoo |
| Keywords | int, integer, number, generator, generate, random, randomly, randomize, chance, test, dice, mock |

## Links

- npm: https://www.npmjs.com/package/random-integral
- Repository: https://github.com/mock-end/random-integral
- Homepage: https://github.com/mock-end/random-integral#readme
- Issues: https://github.com/mock-end/random-integral/issues
- npm.io page: https://npm.io/package/random-integral

## Dependencies (3)

- [clamp](https://npm.io/package/clamp.md) ^1.0.1
- [to-integer](https://npm.io/package/to-integer.md) ^1.0.1
- [max-safe-int](https://npm.io/package/max-safe-int.md) ^1.0.0

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2016-04-25
- 1.0.2 — 2016-04-23
- 1.0.1 — 2016-04-19
- 1.0.0 — 2016-04-15
- 0.0.0 — 2016-04-15

## README

# random-integral

> Return a random integer.

[![MIT License](https://img.shields.io/badge/license-MIT_License-green.svg?style=flat-square)](https://github.com/mock-end/random-integral/blob/master/LICENSE)

[![build:?](https://img.shields.io/travis/mock-end/random-integral/master.svg?style=flat-square)](https://travis-ci.org/mock-end/random-integral)
[![coverage:?](https://img.shields.io/coveralls/mock-end/random-integral/master.svg?style=flat-square)](https://coveralls.io/github/mock-end/random-integral)


## Install

```
$ npm install --save random-integral
```

## Usage

> For more use-cases see the [tests](https://github.com/mock-end/random-integral/blob/master/test/spec/index.js)


```js
var randomInt = require('random-integral');

// API
// - randomInt([options])
```

By default it will return an integer between `-9007199254740992` and `9007199254740992`:

```js
randomInt();
// => -1293235
```

Can optionally provide min and max:

```js
randomInt({ max: 5 });
// => -33569

randomInt({ min: 10, max: 100 });
// => 66

randomInt({ min: -100, max: -10 });
// => -57
```

**Note**:

These `min` and `max` are **inclusive**, so they are included in the range.

This means `randomInt({ min: -2, max: 2 })` would return either `-2`, `-1`, `0`, `1`, or `2`.

```js
// Specific case
-2 <= random number <= 2

// General case
min <= random number <= max
```

## Related

- [random-natural](https://github.com/mock-end/random-natural) - Return a random natural number.
- [random-bool](https://github.com/mock-end/random-bool) - Return a random boolean (true/false).
- [random-char](https://github.com/mock-end/random-char) - Return a random char.
- [random-index](https://github.com/mock-end/random-index) - Return a random array-like index.
- [random-decimal](https://github.com/mock-end/random-decimal) - Return a random decimal.
- [random-binary](https://github.com/mock-end/random-binary) - Return a random binary number.
- [random-octal](https://github.com/mock-end/random-octal) - Return a random octal number.
- [random-hexadecimal](https://github.com/mock-end/random-hexadecimal) - Return a random hexadecimal number.
- [random-unicode](https://github.com/mock-end/random-unicode) - Return a random unicode. 

## Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please [create an issue](https://github.com/mock-end/random-integral/issues/new).

---
_Source: https://npm.io/package/random-integral · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
