<commit_before>Lita::Handlers::Random
======================

[![Gem Version](https://badge.fury.io/rb/lita-random.svg)](http://badge.fury.io/rb/lita-random)
[![Build Status](https://travis-ci.org/braiden-vasco/lita-random.svg)](https://travis-ci.org/braiden-vasco/lita-random)
[![Coverage Status](https://coveralls.io/repos/braiden-vasco/lita-random/badge.svg)](https://coveralls.io/r/braiden-vasco/lita-random)

Generator of random numbers and strings for the [Lita](http://lita.io) chat bot.

Usage
-----

At first, see the documentation for Lita: http://docs.lita.io/

### Installation

Add **lita-random** to your Lita instance's Gemfile:

```ruby
gem 'lita-random', '~> 0.5.1'
```

### Commands

The space between instructions can be skipped, so you can write
`random hex` as `randomhex`, `rand b64` as `randb64`

Arguments for all commands (excluding `random case`, `shuffle` and `sample`)
can be passed as keyword arguments too. Put them after
positional arguments with two dashes before, or the first letter
of argument name with one dash. Examples:

```
You: lita random 5 10
Lita: 7
You: lita random 5 --to 5
Lita: 9
You: lita random 5 -t 10
Lita: 5
You: lita random --to 10 --from 5
Lita: 6
You: lita random -f 5 -t 10
Lita: 9
```

Command `random` has alias `rand`

* `random` -
  random float number, greater or equal to 0 and lesser than 1

* `random <to>` -
  random integer or float number, greater or equal to 0 and lesser than `to`

* `random <from> <to>` -
  random integer or float number, greater or equal to `from` and lesser than `to`

* `random case <s>` -
  randomize case of each character of string `s`

Command `base64` has alias `b64`

* `random base64 <n=16>` -
  random base64 string, length of source string is `n`,
  length of result is about `n * 4 / 3` (24 with default value of `n`)

Command `hex` has aliases `hx` and `x`

* `random hex <n=16>` -
  random hexadecimal string with length `n * 2`

Command `uuid` has alias `uid`

* `random uuid` -
  v4 random UUID (Universally Unique IDentifier). The version 4 UUID
  is purely random (except the version). It doesn’t contain
  meaningful information such as MAC address, time, etc.

Command `password` has alias `pass`

* `random password <n=16>` -
  random password with length `n` containing characters
  in upper and lower case, and digits

* `random smart password <n=8>` -
  random pronounceable password with a minimum length of `n`

* `shuffle <array, ...>` -
  new array with elements of `array` shuffled

* `sample <n=1> <array, ...>` -
  choose `n` random elements from `array`

### Examples

```<commit_msg>Conform argument names in README with actual argument names<commit_after>Lita::Handlers::Random
======================

[![Gem Version](https://badge.fury.io/rb/lita-random.svg)](http://badge.fury.io/rb/lita-random)
[![Build Status](https://travis-ci.org/braiden-vasco/lita-random.svg)](https://travis-ci.org/braiden-vasco/lita-random)
[![Coverage Status](https://coveralls.io/repos/braiden-vasco/lita-random/badge.svg)](https://coveralls.io/r/braiden-vasco/lita-random)

Generator of random numbers and strings for the [Lita](http://lita.io) chat bot.

Usage
-----

At first, see the documentation for Lita: http://docs.lita.io/

### Installation

Add **lita-random** to your Lita instance's Gemfile:

```ruby
gem 'lita-random', '~> 0.5.1'
```

### Commands

The space between instructions can be skipped, so you can write
`random hex` as `randomhex`, `rand b64` as `randb64`

Arguments for all commands (excluding `random case`, `shuffle` and `sample`)
can be passed as keyword arguments too. Put them after
positional arguments with two dashes before, or the first letter
of argument name with one dash. Examples:

```
You: lita random 5 10
Lita: 7
You: lita random 5 --to 5
Lita: 9
You: lita random 5 -t 10
Lita: 5
You: lita random --to 10 --from 5
Lita: 6
You: lita random -f 5 -t 10
Lita: 9
```

Command `random` has alias `rand`

* `random` -
  random float number, greater or equal to 0 and lesser than 1

* `random <to>` -
  random integer or float number, greater or equal to 0 and lesser than `to`

* `random <from> <to>` -
  random integer or float number, greater or equal to `from` and lesser than `to`

* `random case <string>` -
  randomize case of each character of string `string`

Command `base64` has alias `b64`

* `random base64 <size=16>` -
  random base64 string, length of source string is `size`,
  length of result is about `size * 4 / 3` (24 with default value of `size`)

Command `hex` has aliases `hx` and `x`

* `random hex <size=16>` -
  random hexadecimal string with length `size * 2`

Command `uuid` has alias `uid`

* `random uuid` -
  v4 random UUID (Universally Unique IDentifier). The version 4 UUID
  is purely random (except the version). It doesn’t contain
  meaningful information such as MAC address, time, etc.

Command `password` has alias `pass`

* `random password <length=16>` -
  random password with length `length` containing characters
  in upper and lower case, and digits

* `random smart password <length=8>` -
  random pronounceable password with a minimum length of `length`

* `shuffle <array, ...>` -
  new array with elements of `array` shuffled

* `sample <count=1> <array, ...>` -
  choose `count` random elements from `array`

### Examples

```
{'fraction_non_alphanumeric': 0.13737297704177645, 'fraction_numerical': 0.01957094467444486, 'mean_word_length': 3.971936389148737, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 27, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1129169', 'n_tokens_mistral': 1856, 'n_tokens_neox': 1734, 'n_words': 678}