# iso-random

> Cryptographically secure random number generator using `/dev/urandom` with fallback to node's `crypto` and finally to `window.crypto || window.mscrypto`.

Latest version **0.4.0** (published 2020-09-21) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2020-09-21 |
| First published | 2020-09-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=7 |
| Dependencies | 7 |
| Unpacked size | 9.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 0 |
| Author | isysd |
| Maintainers | isysd |
| Keywords | isomorphic, guld, random, crypto |

## Links

- npm: https://www.npmjs.com/package/iso-random
- Repository: https://github.com/isysd-mirror/iso-random
- Homepage: https://github.com/isysd-mirror/iso-random/
- Issues: https://github.com/isysd-mirror/iso-random/issues
- npm.io page: https://npm.io/package/iso-random

## Dependencies (7)

- [esm](https://npm.io/package/esm.md) ../esm
- [iso-util](https://npm.io/package/iso-util.md) ../iso-util
- [iso-stream](https://npm.io/package/iso-stream.md) ../iso-stream
- [iso-process](https://npm.io/package/iso-process.md) ../iso-process
- [always-global](https://npm.io/package/always-global.md) ../always-global
- [iso-randombytes](https://npm.io/package/iso-randombytes.md) ../iso-randombytes
- [iso-read-random](https://npm.io/package/iso-read-random.md) ../iso-read-random

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 0.4.0 (latest) — 2020-09-21

## README

# random

Cryptographically secure random number generator using `/dev/urandom` with fallback to node's `crypto` and finally to `window.crypto || window.mscrypto`.

### Usage

```
// get random buffer of length 100
var buff = await randBuffer(100)

// get random, alphanumeric (default) string of length 100
var str = await randStr(100)

// get random, alphanumeric + special string of length 100
var str = await randStr(100, 'all')

// get random number less than or equal to 100
var num = await randInt(100)

// get random timestamp from within range of unix timestamps (seconds)
var time = randTimestamp(date.now()/1000 - 10000, date.now()/1000)
```

##### Node

```
import { haystack, randBuffer, randStr, randInt } from '../random/random.js'
```

### License

MIT Copyright isysd

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