

 
Manual Reference Pages  MATH::RANDOM::SECURE::RNG (3)
.ds Aq ’
NAME
Math::Random::Secure::RNG  The underlying PRNG, as an object.
CONTENTS
SYNOPSIS
use Math::Random::Secure::RNG;
my $rng = Math::Random::Secure::RNG>new();
my $int = $rng>irand();
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 objectoriented interface
to a randomnumber 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
irand
Generates a random unsigned 32bit integer.
rand
Generates a random floatingpoint number greater than or equal to 0
and less than 1.
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. This means minimally, it
should be 8 bytes (64 bits) and more ideally, 32 bytes (256 bits) or 64
bytes (512 bits). For an idea of how large your seed should be, see
<http://burtleburtle.net/bob/crypto/magnitude.html#brute> for information
on how long it would take to bruteforce seeds of each size.
Note that seed should not be an integer, but a <B>string of bytesB>.
It is very important that the seed be large enough, and also that the seed
be very random. <B>There are serious attacks possible against random number
generators that are seeded with nonrandom data or with insufficient random
data.B>
By default, we use a 512bit (64 byte) seed. If
Moore’s Law <http://en.wikipedia.org/wiki/Moore’s_law> continues to hold
true, it will be approximately 1000 years before computers can bruteforce a
512bit (64 byte) seed at any reasonable speed (and physics suggests that
computers will never actually become that fast, although there could always
be improvements or new methods of computing we can’t now imagine, possibly
making Moore’s Law continue to hold true forever).
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.
Defaults to 64 bytes (which is 512 bits).
See seed for more info about what is a reasonable seed size.
SEE ALSO
Math::Random::Secure
perl v5.20.3  MATH::RANDOM::SECURE::RNG (3)  20110125 
Visit the GSP FreeBSD Man Page Interface. Output converted with manServer 1.07. 