# 笙サ�� Random::Simple

Perl module to generate good random numbers in a user consumable way.

## 笶� Why Random::Simple?

To make generating random numbers as easy as possible _and_ in a manner that
you can use in real code. Generate "good" random numbers without having to
think about it.

## 逃 Installation

```bash
cpanm Random::Simple
```

## 捗 Usage

```perl
use Random::Simple;

my $integer = random_int($min, $max); # inclusive
my $float   = random_float();         # 0 - 1 inclusive
my $bytes   = random_bytes($count);   # string of X bytes

my $die_roll       = random_int(1, 6);
my $random_percent = random_float() * 100;
my $buffer         = random_bytes(8);
```

## ァ� Methodology

Perl's internal `rand()` function uses `drand48()` which is an older PRNG,
and may have limitations. `Random::Simple` uses
[PCG](https://www.pcg-random.org/download.html) which is: modern, simple,
well vetted, and fast.

`Random::Simple` is automatically seeded with high quality entropy directly
from your OS. On Linux this is `/dev/urandom` and on Windows it uses
CryptGenRandom. You will get statistically unique random numbers
automatically.

## 剥 See also

If you need finer grained control of your random numbers check out one
of these alternatives:

* [Math::Random::PCG32](https://metacpan.org/pod/Math::Random::PCG32)
* [Math::Random::ISAAC](https://metacpan.org/pod/Math::Random::ISAAC)
* [Math::Random::MT](https://metacpan.org/pod/Math::Random::MT)
* [Math::Random::Secure](https://metacpan.org/pod/Math::Random::Secure)

## 其 Author

Scott Baker - https://www.perturb.org/