# true-random-promise

> True randomness (http://qrng.anu.edu.au/)

Latest version **2.0.1** (published 2021-04-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install true-random-promise
pnpm add true-random-promise
yarn add true-random-promise
bun add true-random-promise
```

## 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 | 2.0.1 |
| Published | 2021-04-12 |
| First published | 2021-04-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | marshallasch |
| Keywords | random, sequence, integer, string |

## Links

- npm: https://www.npmjs.com/package/true-random-promise
- Repository: https://github.com/marshallasch/node-true-random
- Homepage: https://github.com/marshallasch/node-true-random#readme
- Issues: https://github.com/marshallasch/node-true-random/issues
- npm.io page: https://npm.io/package/true-random-promise

## Dependencies (1)

- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.1

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 2.0.1 (latest) — 2021-04-12
- 2.0.0 — 2021-04-12

## README

node-true-random is a true random "generator" written in ecmascript 6.
It caches random numbers from http://qrng.anu.edu.au/ for you to use.

Why ecmascript 6 you might ask? Because classes are awesome!

It's very simple to use:

```node
const { Random } = require('true-random'); //Import the library
const gen = new Random(); //Create a number generator, this function accepts a cache_size, min_cache and a debugging

//returns primise that resolves to an  integer between 0 and 1, you can pass different min and max values with integer(min, max)
gen.integer()
    .then((i) => console.log(i));

//returns a promise that resolves to an array with 10 numbers between 0 and 1, the min, max and number of integers can be passed to this function.
gen.integers(0, 1, 10)
    .then((int_array) => console.log(int_array));
```


### Example 1:

```node

//Display a random number between 1 and 7
const { Random } = require('true-random');
const gen = new Random(10, 5);

gen.integer(1, 7)
    .then((i) => console.log(i));
```

### Example 2:
```node

//Display a random array of 25 numbers between 700 and 15000
const { Random } = require('true-random');
const gen = new random.true_rand(100, 50);

gen.integers(700, 15000, 25)
    .then((int_array) => console.log(int_array));
```

TODO:
* Cleanup code

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