# crypto-random-bigint

> Generate a cryptographically-random BigInt with the given number of bits of entropy.

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

## Install

```sh
npm install crypto-random-bigint
pnpm add crypto-random-bigint
yarn add crypto-random-bigint
bun add crypto-random-bigint
```

## 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.1.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 | 4.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Maintainers | fabiospampinato |
| Keywords | crypto, random, bigint, number |

## Links

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

## Dependencies (1)

- [uint-rng](https://npm.io/package/uint-rng.md) ^1.2.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.1.1 (latest) — 2025-01-13
- 2.1.0 — 2023-08-05
- 2.0.1 — 2023-08-04
- 2.0.0 — 2022-04-05
- 1.1.0 — 2022-02-08
- 1.0.0 — 2022-02-06

## README

# Crypto Random BigInt

Generate a cryptographically-random BigInt with the given number of bits of entropy.

It's pretty darn fast, tiny, and it works everywhere. It's like a purer version of [`nanoid`](https://github.com/ai/nanoid).

## Install

```sh
npm install crypto-random-bigint
```

## Usage

```ts
import random from 'crypto-random-bigint';

// Let's get some random BigInts

random ( 8 ); // => 132n
random ( 16 ); // => 54279n
random ( 32 ); // => 3564608120n
random ( 64 ); // => 15255558299082773463n
random ( 128 ); // => 102272854662000556975733753112255674405n
```

## License

MIT © Fabio Spampinato

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