No subject


Tue Dec 2 02:44:59 GMT 2003


"Sets the random number seed for the "rand" opera=ADtor.  If EXPR is =
omitted,
uses a semi-random value supplied by the kernel (if it supports the
/dev/urandom device) or based on the current time and process ID, among
other things.  In versions of Perl prior to 5.004 the default seed was =
just
the current "time".  This isn't a particularly good seed, so many old
programs supply their own seed value (often "time ^ $$" or "time ^ ($$ =
+ ($$
<< 15))"), but that isn't necessary any more."

time() has only second resolution and MacPerl may not have decent =
access to
a process ID. So there may not be much randomness going on. At the very
least, hashing the value of time() -- perhaps with Crypt::SHA for good
entropy -- would be a good idea.

You might want to use Math::TrulyRandom or Math::RandomOrg modules to
initialise the seed. Math::TrulyRandom depends on some pretty unixy C =
code,
however. Math::RandomOrg doesn't, but does need an internet connection.

http://www.cpan.org/modules/by-module/Math/




More information about the linux mailing list