Subject: | eval method for Math::Random::Secure not working |
Without Math::Random::Secure installed, the module dies since the use statement is bare (it is executed when the module is loaded regardless of the if() around it). A different method for loading this is going to be needed. Doing the require and import while still getting rand() to be exported is not as clear.
Since the docs currently say "FAST", I will also point out that Math::Random::Secure's rand is one of the slowest implementations available. $random->int(n) is about 20x slower using that module vs. core rand. Crypt::PRNG, Math::Random::MT::Auto, ntheory, and Math::Random::MTwist could be used without other changes and are much faster (Crypt::PRNG and ntheory both use proper seeding and CSPRNGs -- both ChaCha20 rather than ISAAC though neither algorithm has known issues).
All your rand() calls seem to be done as CORE::int(rand( n )), which means you could use an irand() function. Math::Prime::Util::GMP and ntheory both have a urandomm(n) call which does exactly what you want, but for the other modules below you'd have to roll your own. For the small performance benefit you could just use CORE::int(rand(n)) without much penalty (for the modules with that call).
Non-crypto:
Math::Random::MTwist
Math::Random::Xorshift
Math::Random::MT::Auto
Math::Random::MT
Crypto:
Math::Random::ISAAC
Math::Random::ISAAC::XS
Math::Prime::Util::GMP
ntheory
Bytes::Random::Secure
Bytes::Random::Secure::Tiny
Crypt::PRNG
A downside of Perl / CPAN here -- too many choices.