1Math::Random::Secure::RUNsGe(r3)Contributed Perl DocumenMtaatthi:o:nRandom::Secure::RNG(3)
2
3
4
6 Math::Random::Secure::RNG - The underlying PRNG, as an object.
7
9 version 0.080001
10
12 use Math::Random::Secure::RNG;
13 my $rng = Math::Random::Secure::RNG->new();
14 my $int = $rng->irand();
15
17 This represents a random number generator, as an object.
18
19 Generally, you shouldn't have to worry about this, and you should just
20 use Math::Random::Secure. But if for some reason you want to modify how
21 the random number generator works or you want an object-oriented
22 interface to a random-number generator, you can use this.
23
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
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
77 Math::Random::Secure
78
80 · Max Kanat-Alexander <mkanat@cpan.org>
81
82 · Arthur Axel "fREW" Schmidt
83 <math-random-secure@afoolishmanifesto.com>
84
86 This software is Copyright (c) 2010 by BugzillaSource, Inc.
87
88 This is free software, licensed under:
89
90 The Artistic License 2.0 (GPL Compatible)
91
92
93
94perl v5.28.1 2017-03-12 Math::Random::Secure::RNG(3)