Math::...re::RNG(3pm)
β¨ Math::...re::RNG π
okay so bestie, this is the User Contributed Perl Documentation for Math::Random::Secure::RNG, and it is literally the little engine underneath the whole random-number situation π
πΈ NAME πΈ
Math::Random::Secure::RNG β the underlying PRNG, as an object. yes. an object. it's giving very OOP of it π
β VERSION β
version 0.080001 β that's the vibe check, and it passed π«Ά
π§ SYNOPSIS π§
use Math::Random::Secure::RNG;
my $rng = Math::Random::Secure::RNG->new();
my $int = $rng->irand();
that's it. that's the whole thing. iconic behavior honestly πβ¨
π DESCRIPTION π
So this thing represents a random number generator, as an object. like, the RNG itself is now a lil guy you can hold π₯Ί
ngl, generally you should not have to worry about this at all β you should just use Math::Random::Secure and go live your life. periodt. But if for some reason you wanna modify how the random number generator works, or you just really want an object-oriented interface to a random-number generator?? then bestie, this is your moment. main character energy, go off π
π₯ METHODS π₯
irand π²
Generates a random unsigned 32-bit integer. big numbers, no negativity allowed π
rand π¦
Generates a random floating-point number that is greater than or equal to 0 and less than 1. so like 0 <= x < 1, no cap.
π ATTRIBUTES π
These are all options that can be passed to new() or called as methods on an existing object. so you can set 'em at birth or later, whatever fits your schedule π
rng π
The underlying random number generator. defaults to an instance of Math::Random::ISAAC. that's the plug fr fr.
seed π±
The random data used to seed rng, as a string of bytes. this should be large enough to properly seed rng. and "large enough" means, minimally, it should be 8 bytes (64 bits), and more ideally 32 bytes (256 bits) or 64 bytes (512 bits). if you want an idea of how large your seed should be, peep <http://burtleburtle.net/bob/crypto/magnitude.html#brute> for info on how long it would take to brute-force seeds of each size. nerd stuff, but important nerd stuff π
β οΈ note that seed should not be an integer β it should be a string of bytes. do not come in here with an integer, bestie, i'm begging π
It is very important that the seed be large enough, and also that the seed be very random. there are serious attacks possible against random number generators that are seeded with non-random data or with insufficient random data. like, this is the part where we do NOT play π
By default, we use a 512-bit (64 byte) seed. and 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 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.) so like. you're good. probably. π§β¨
If you pass this to new(), seeder and seed_size will be ignored. they simply don't get a turn to speak π
seeder π
An instance of Crypt::Random::Source::Base that will be used to get the seed for rng. the lil seed supplier.
seed_size π
How much data (in bytes) should be read using seeder to seed rng. defaults to 64 bytes (which is 512 bits). a very generous default, honestly.
See seed for more info about what is a reasonable seed size. π
π SEE ALSO π
Math::Random::Secure
π AUTHORS π
- Max Kanat-Alexander
<mkanat@cpan.org> - Arthur Axel "fREW" Schmidt
<math-random-secure@afoolishmanifesto.com>
legends, both of them π«Ά
π COPYRIGHT AND LICENSE π
This software is Copyright (c) 2010 by BugzillaSource, Inc.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
and that's a wrap bestie!! π this lil doc came to you from perl v5.32.0, dated 2021-01-06, and honestly? she ate. go forth and generate random numbers responsibly, mwah πβ¨
π¦ where this page comes from
- debian bookworm: libmath-random-secure-perl 0.080001-1.1 Β· Artistic-2.0
- debian trixie: libmath-random-secure-perl 0.080001-1.1 Β· Artistic-2.0
- ubuntu jammy: libmath-random-secure-perl 0.080001-1.1 Β· Artistic-2.0
- ubuntu noble: libmath-random-secure-perl 0.080001-1.1 Β· Artistic-2.0
- ubuntu resolute: libmath-random-secure-perl 0.080001-1.1 Β· Artistic-2.0
- ubuntu stonking: libmath-random-secure-perl 0.080001-1.1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms