# crypto-random-in-range

> Pick a cryptographically-random integer within a range.

Latest version **2.0.1** (published 2025-01-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install crypto-random-in-range
pnpm add crypto-random-in-range
yarn add crypto-random-in-range
bun add crypto-random-in-range
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2025-01-13 |
| First published | 2022-02-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | fabiospampinato |
| Keywords | crypto, random, number, range, pick, between |

## Links

- npm: https://www.npmjs.com/package/crypto-random-in-range
- Repository: https://github.com/fabiospampinato/crypto-random-in-range
- Homepage: https://github.com/fabiospampinato/crypto-random-in-range#readme
- Issues: https://github.com/fabiospampinato/crypto-random-in-range/issues
- npm.io page: https://npm.io/package/crypto-random-in-range

## Dependencies (1)

- [crypto-random-bigint](https://npm.io/package/crypto-random-bigint.md) ^2.1.1

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2025-01-13
- 2.0.0 — 2022-04-05
- 1.0.1 — 2022-02-08
- 1.0.0 — 2022-02-06

## README

# Crypto Random In Range

Pick a cryptographically-random integer within a range.

## Install

```sh
npm install crypto-random-in-range
```

## Usage

```ts
import inRange from 'crypto-random-in-range';

// Let's pick a random number within some ranges

inRange ( 0, 100 ); // => 76n
inRange ( 0n, 100n ); // => 61n
inRange ( 0n, 9999999999999999999999999999999999999999n ); // => 6084146398709470868721131064012104523887n
```

## License

MIT © Fabio Spampinato

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