.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Math::Random::Secure::RNG 3pm" .TH Math::Random::Secure::RNG 3pm "2019-05-29" "perl v5.24.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Math::Random::Secure::RNG \- The underlying PRNG, as an object. .SH "VERSION" .IX Header "VERSION" version 0.080001 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use Math::Random::Secure::RNG; \& my $rng = Math::Random::Secure::RNG\->new(); \& my $int = $rng\->irand(); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This represents a random number generator, as an object. .PP 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. .SH "METHODS" .IX Header "METHODS" .SS "irand" .IX Subsection "irand" Generates a random unsigned 32\-bit integer. .SS "rand" .IX Subsection "rand" Generates a random floating-point number greater than or equal to 0 and less than 1. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" These are all options that can be passed to \f(CW\*(C`new()\*(C'\fR or called as methods on an existing object. .SS "rng" .IX Subsection "rng" The underlying random number generator. Defaults to an instance of Math::Random::ISAAC. .SS "seed" .IX Subsection "seed" The random data used to seed \*(L"rng\*(R", as a string of bytes. This should be large enough to properly seed \*(L"rng\*(R". This means \fIminimally\fR, 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 for information on how long it would take to brute-force seeds of each size. .PP Note that \f(CW\*(C`seed\*(C'\fR should not be an integer, but a \fBstring of bytes\fR. .PP It is very important that the seed be large enough, and also that the seed be very random. \fBThere are serious attacks possible against random number generators that are seeded with non-random data or with insufficient random data.\fR .PP By default, we use a 512\-bit (64 byte) seed. If Moore's Law continues to hold true, it will be approximately 1000 years before computers can brute-force a 512\-bit (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). .PP If you pass this to \f(CW\*(C`new()\*(C'\fR, \*(L"seeder\*(R" and \*(L"seed_size\*(R" will be ignored. .SS "seeder" .IX Subsection "seeder" An instance of Crypt::Random::Source::Base that will be used to get the seed for \*(L"rng\*(R". .SS "seed_size" .IX Subsection "seed_size" How much data (in bytes) should be read using \*(L"seeder\*(R" to seed \*(L"rng\*(R". Defaults to 64 bytes (which is 512 bits). .PP See \*(L"seed\*(R" for more info about what is a reasonable seed size. .SH "SEE ALSO" .IX Header "SEE ALSO" Math::Random::Secure .SH "AUTHORS" .IX Header "AUTHORS" .IP "\(bu" 4 Max Kanat-Alexander .IP "\(bu" 4 Arthur Axel \*(L"fREW\*(R" Schmidt .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is Copyright (c) 2010 by BugzillaSource, Inc. .PP This is free software, licensed under: .PP .Vb 1 \& The Artistic License 2.0 (GPL Compatible) .Ve