MakerandSection: User Contributed Perl Documentation (3)Updated: 2004-10-19 |
MakerandSection: User Contributed Perl Documentation (3)Updated: 2004-10-19 |
use Crypt::Makerand; $rand = Crypt::Makerand::trand32();
The basic idea here is that between clock ``skew'' and various hard-to-predict OS event arrivals, counting a tight loop will yield a little (maybe a third of a bit or so) of ``good'' randomness per interval clock tick. This seems to work well even on unloaded machines. If there is a human operator at the machine, you should augment truerand with other measure, like keyboard event timing.
On server machines (e.g., when you need to generate a Diffie-Hellman secret) truerand alone may be good enough.
unsigned long trand32(void)