Crypt::Random is a Perl interface module to the /dev/random device found on most modern unix systems. It also interfaces with egd, a user space entropy gathering daemon, available for systems where /dev/random (or similar) devices are not available. When Math::Pari is installed, Crypt::Random can generate random integers of arbritary size of a given bitsize or in a specified interval.
use Crypt::Random qw( makerandom );
my $r = makerandom ( Size = > 512, Strength = > 1 );