1Math::Random::Secure::RUNsGe(r3)Contributed Perl DocumenMtaatthi:o:nRandom::Secure::RNG(3)
2
3
4

NAME

6       Math::Random::Secure::RNG - The underlying PRNG, as an object.
7

SYNOPSIS

9        use Math::Random::Secure::RNG;
10        my $rng = Math::Random::Secure::RNG->new();
11        my $int = $rng->irand();
12

DESCRIPTION

14       This represents a random number generator, as an object.
15
16       Generally, you shouldn't have to worry about this, and you should just
17       use Math::Random::Secure. But if for some reason you want to modify how
18       the random number generator works or you want an object-oriented
19       interface to a random-number generator, you can use this.
20
21       Math::Random::Secure::RNG uses Any::Moose, meaning that it has a "new"
22       method that works like Mouse or Moose modules work.
23

METHODS

25   irand
26       Generates a random unsigned 32-bit integer.
27
28   rand
29       Generates a random floating-point number greater than or equal to 0 and
30       less than 1.
31

ATTRIBUTES

33       These are all options that can be passed to "new()" or called as
34       methods on an existing object.
35
36   rng
37       The underlying random number generator. Defaults to an instance of
38       Math::Random::ISAAC.
39
40   seed
41       The random data used to seed "rng", as a string of bytes. This should
42       be large enough to properly seed "rng". This means minimally, it should
43       be 8 bytes (64 bits) and more ideally, 32 bytes (256 bits) or 64 bytes
44       (512 bits). For an idea of how large your seed should be, see
45       <http://burtleburtle.net/bob/crypto/magnitude.html#brute> for
46       information on how long it would take to brute-force seeds of each
47       size.
48
49       Note that "seed" should not be an integer, but a string of bytes.
50
51       It is very important that the seed be large enough, and also that the
52       seed be very random. There are serious attacks possible against random
53       number generators that are seeded with non-random data or with
54       insufficient random data.
55
56       By default, we use a 512-bit (64 byte) seed. If Moore's Law
57       <http://en.wikipedia.org/wiki/Moore's_law> continues to hold true, it
58       will be approximately 1000 years before computers can brute-force a
59       512-bit (64 byte) seed at any reasonable speed (and physics suggests
60       that computers will never actually become that fast, although there
61       could always be improvements or new methods of computing we can't now
62       imagine, possibly making Moore's Law continue to hold true forever).
63
64       If you pass this to "new()", "seeder" and "seed_size" will be ignored.
65
66   seeder
67       An instance of Crypt::Random::Source::Base that will be used to get the
68       seed for "rng".
69
70   seed_size
71       How much data (in bytes) should be read using "seeder" to seed "rng".
72       Defaults to 64 bytes (which is 512 bits).
73
74       See "seed" for more info about what is a reasonable seed size.
75

SEE ALSO

77       Math::Random::Secure
78
79
80
81perl v5.12.3                      2011-01-25      Math::Random::Secure::RNG(3)
Impressum