# orzo

> A library for random events like dice rolls and random strings.

Latest version **0.4.1** (published 2017-03-29) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.1 |
| Published | 2017-03-29 |
| First published | 2015-11-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Ryen Nelsen |
| Maintainers | ryennelsen |
| Keywords | luck, dice, uuid, random, generator, generate, number, numbers |

## Links

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

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.4.1 (latest) — 2017-03-29
- 0.4.0 — 2016-02-20
- 0.3.3 — 2015-11-30
- 0.3.2 — 2015-11-30
- 0.3.1 — 2015-11-30
- 0.3.0 — 2015-11-27
- 0.2.0 — 2015-11-27
- 0.1.0 — 2015-11-27

## README

orzo
====

[![Build Status](https://travis-ci.org/RyenNelsen/orzo.svg?branch=master)](https://travis-ci.org/RyenNelsen/orzo) [![Coverage Status](https://coveralls.io/repos/github/RyenNelsen/orzo/badge.svg?branch=master)](https://coveralls.io/github/RyenNelsen/orzo?branch=master)

A library for random events like dice rolls and random strings.


Table of Contents
-----------------

 * [Requirements](#requirements)
 * [Usage](#usage)
 * [Contributing](#contributing)
 * [License](#license)


Requirements
------------
orzo requires the following to run:

 * [Node.js](https://nodejs.org/)
 * [npm](https://www.npmjs.com/) (usually comes with Node.js)


Usage
-----
orzo is easily installed with [npm](https://www.npmjs.com/):
```bash
npm install orzo
```

Then you can load the library into your project with a `require`:
```js
var orzo = require('orzo');
```

The orzo object has the following methods:

### `orzo.dice({ min: 1, max: 6 })`
Returns a random number between the min and max values.

 * `min` is the lowest possible random number (inclusive). (*Number*, **Optional**, Default: 1)
 * `max` is the highest possible random number (inclusive). (*Number*, **Optional**, Default: 6)
 * `return` is a random number (*Number*)

```js
// examples
orzo.dice() // 4
orzo.dice({ max: 20 }) // 13
orzo.dice({ min: -50, max: 50 }); // -12
```

### `orzo.chars({chars: '', len: 10 })`
Returns a random set of characters.

 * `chars` is the character set for the random string. (*String*, **Optional**, Default: 'abcdefghijklmnopqrstuvwxyzABCDEFGHHIJKLMNOPQRSTUVWXUZ0123456789')
 * `len` is the length for the random string. (*Number*, **Optional**, Default: 10)
 * `return` is a string with random characters. (*String*)

```js
// examples
orzo.chars() // FBnQPprZw3
orzo.chars({ len: 25, chars: orzo.HEX_CHARACTERS }) // ff0b28ef67d91e04c1b707169
```

### `orzo.uuid()`
Returns a valid UUIDv4.

 * `returns` a UUIDv4. (*String*)

```js
// example
orzo.uuid() // 5287a662-0623-4ff4-8228-3a3b371926a3
```

### `orzo.encode({ input: '', chars: '' })`
Returns a string encoded in a specified base.

 * `input` is the input to convert to the different base. (*String*)
 * `chars` is the character set for the new base. (*String*, **Optional**, Default: 'abcdefghijklmnopqrstuvwxyzABCDEFGHHIJKLMNOPQRSTUVWXUZ0123456789')
 * `return` is a string in the custom base. (*String*)

```js
// examples

// encode 1999 to base16
orzo.encode({input: 1999, chars: orzo.HEX_CHARACTERS}) // 7cf

// encode 1999 to base62
orzo.encode({input: 1999}) // wf
```

### `orzo.decode({ input: '', chars: '' })`
Returns a string back to base10.

 * `input` is the input to convert to base10. (*String*)
 * `chars` the characters used previously to conver the base. (*String*, **Optional**, Default: 'abcdefghijklmnopqrstuvwxyzABCDEFGHHIJKLMNOPQRSTUVWXUZ0123456789')
 * `return` is a string in base10. (*String*)

```js
// examples

// decode 7cf from base16 to base10
orzo.decode({input: '7cf', chars: orzo.HEX_CHARACTERS}) // 1999

// decode wf from base62 to base10
orzo.decode({input: 'wf'}) // 1999
```

### Constants
Various character sets to use.
 * `orzo.NUMBERS` = 0123456789
 * `orzo.LOWERCASE_CHARACTERS` = abcdefghijklmnopqrstuvwxyz
 * `orzo.UPPERCASE_CHARACTERS` = ABCDEFGHIJKLMNOPQRSTUVWXYZ
 * `orzo.SPECIAL_CHARACTERS` = !@#$%^&*()
 * `orzo.HEX_CHACTERS` = 0123456789abcdef


Contributing
------------
To contribute to orzo, clone this repo locally and commit your code on a new branch. Unit tests are required for all features.


License
-------
orzo is licensed under the MIT license.

Copyright &copy; 2015, Ryen Nelsen

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