NAME
Math::Random::Secure::RNG - The underlying PRNG, as an object.
SYNOPSIS
use Math::Random::Secure::RNG;
my $rng = Math::Random::Secure::RNG->new();
my $int = $rng->generate();
DESCRIPTION
This represents a random number generator, as an object.
Generally, you shouldn't have to worry about this, and you should just use Math::Random::Secure. But if for some reason you want to modify how the random number generator works or you want an object-oriented interface to a random-number generator, you can use this.
Math::Random::Secure::RNG uses Any::Moose, meaning that it has a new
method that works like Mouse or Moose modules work.
METHODS
generate
Generates a random unsigned 32-bit integer.
ATTRIBUTES
These are all options that can be passed to new()
or called as methods on an existing object.
rng
The underlying random number generator. Defaults to an instance of Math::Random::ISAAC.
seed
The random data used to seed "rng", as a string of bytes. This should be large enough to properly seed "rng". For the default ISAAC implementation, this means it must be 1024 bytes (256 32-bit integers). It is very important that the seed be large enough. There are serious attacks possible against random number generators that are seeded with non-random data or with insufficient random data.
If you pass this to new()
, "seeder" and "seed_size" will be ignored.
seeder
An instance of Crypt::Random::Source::Base that will be used to get the seed for "rng".
seed_size
How much data (in bytes) should be read using "seeder" to seed "rng".