# NAME Random::Simple - Generate good random numbers in a user consumable way. # SYNOPSIS use Random::Simple; my $coin_flip = random_int(1, 2); my $die_roll = random_int(1, 6); my $random_percent = random_float() * 100; my $buffer = random_bytes(8); my @arr = ('red', 'green', 'blue'); my $rand_item = $arr[random_int(0, @arr - 1)]; # Random array item # DESCRIPTION Perl's internal `rand()` function uses `drand48` which is an older pseudorandom number generator and may have limitations. `Random::Simple` uses PCG which is: modern, simple, well vetted, and fast. Using `Random::Simple` will automatically upgrade/override the core `rand()` function to use a better PRNG. `Random::Simple` is automatically seeded with 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. # METHODS - **random\_int($min, $max)** returns a non-biased integer between `$min` and `$max` (inclusive). Range must be no larger than 2\*\*32 - 2. - **random\_float()** returns a random floating point value between 0 and 1 (inclusive). - **random\_bytes($number)** returns a string of random bytes with length of `$number`. - **rand()** emulates `CORE::rand()` using a better PRNG. # BUGS Submit issues on Github: [https://github.com/scottchiefbaker/perl-Random-Simple/issues](https://github.com/scottchiefbaker/perl-Random-Simple/issues) # SEE ALSO - [Math::Random::PCG32](https://metacpan.org/pod/Math%3A%3ARandom%3A%3APCG32) - [Math::Random::ISAAC](https://metacpan.org/pod/Math%3A%3ARandom%3A%3AISAAC) - [Math::Random::MT](https://metacpan.org/pod/Math%3A%3ARandom%3A%3AMT) - [Math::Random::Secure](https://metacpan.org/pod/Math%3A%3ARandom%3A%3ASecure) # AUTHOR Scott Baker - [https://www.perturb.org/](https://www.perturb.org/)