# csprng

> Secure random numbers of any size in any base

Latest version **0.1.2** (published 2017-01-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install csprng
pnpm add csprng
yarn add csprng
bun add csprng
```

## Health

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

Positive: has types package; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2017-01-29 |
| First published | 2013-09-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/csprng) |
| Module format | CommonJS |
| Node | >=0.6.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 36 |
| Author | James Coglan |
| Maintainers | jcoglan |
| Keywords | crypto, math, random, security |

## Links

- npm: https://www.npmjs.com/package/csprng
- Repository: https://github.com/jcoglan/node-csprng
- Homepage: http://github.com/jcoglan/node-csprng
- Issues: http://github.com/jcoglan/node-csprng/issues
- npm.io page: https://npm.io/package/csprng

## Dependencies (1)

- [sequin](https://npm.io/package/sequin.md) *

## 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.1.2 (latest) — 2017-01-29
- 0.1.1 — 2013-09-14
- 0.1.0 — 2013-09-14

## README

# csprng

Generates secure random numbers using `crypto.randomBytes()`. Numbers can be of
any magnitude and in any base from 2 to 36.


## Installation

```
$ npm install csprng
```


## Usage

Call the function passing the number of required bits, and the radix of the
output.

```js
var rand = require('csprng');

rand(160, 36) // -> 'tq2pdxrblkbgp8vt8kbdpmzdh1w8bex'
```


## License

(The MIT License)

Copyright (c) 2013-2017 James Coglan

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the 'Software'), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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