# randomkey

> Lightweight node.js lib for generating random strings from a character set

Latest version **1.0.0** (published 2015-07-15) · MIT license · 0 weekly downloads

## Install

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

## 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 | 1.0.0 |
| Published | 2015-07-15 |
| First published | 2015-07-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Jed Watson |
| Maintainers | jedwatson |
| Keywords | util, utils, random, number, string, key |

## Links

- npm: https://www.npmjs.com/package/randomkey
- Repository: https://github.com/JedWatson/randomkey
- Homepage: https://github.com/JedWatson/randomkey#readme
- Issues: https://github.com/JedWatson/randomkey/issues
- npm.io page: https://npm.io/package/randomkey

## 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

- 1.0.0 (latest) — 2015-07-15

## README

# Randomkey

Lightweight node.js lib for generating random strings.

You can specify the length and character set to use.

If you specify length as an array `[min, max]` a number in the range will be
used.

The character set defaults to:

```
0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz
```

Several character sets are provided as properties of the function:

* `default`: `0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz`
* `upper`: `ABCDEFGHIJKLMNOPQRSTUVWXTZ`
* `lower`: `abcdefghijklmnopqrstuvwxtz`
* `alphanumeric`: `0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ`
* `numbers`: `0123456789`
* `safe`: `2346789ABCDEFGHJKLMNPRTUVWXTZ`

## Usage

```
npm install --save randomkey
```

### randomkey(len, chars)

```
var rk = require('randomkey');

// generate a 10 character key using the default character set
var key = rk(10);

// generate a 6 character key using only the characters `a`, `b` and `c`
var abc = rk(10, 'abc');

// generate a 16 character key using the "safe" character set:
var safe = rk(16, rk.safe);

// generate a key between 5 and 10 characters long with the default characters:
var variableLength = rk([5,10]);

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