|
Math::Rand48 - perl bindings for drand48 family of random functions |
Math::Rand48 - perl bindings for drand48() family of random functions
use Math::Rand48;
my $n = drand48(); # Float value [0.0,1.0) my $seed = seed48(); # Get seed for drand48, lrand48, mrand48 my $m = erand48($seed); # Float value [0.0,1.0) - modifies $seed
seed48($seed); # Set seed for drand48, lrand48, mrand48
use Math::Rand48 qw(lrand48); my $un = lrand48(); my $um = nrand48($seed);
This package provides an interface to the 48-bit family of random number functions, commonly provided on UNIX systems.
seed48drand48, lrand48, mrand48.
If given an argument sets the seed to that value.
drand48erand48($seed)erand48.
lrand48nrand48($seed)nrand48.
mrand48jrand48($seed)jrand48.
The $seed above are perl scalars. When in use they are converted to 6 byte binary ``strings''. If the incoming value is a string of less then 6 bytes it is padded with 0xFF. If the incoming value is a string of more than 6 bytes it is ``hashed'' using perl's hash function to yield a 32 bit value which is then padded with two bytes of 0xFF. If the incoming value is an integer it is used for 4 bytes, with two bytes of 0xFF.
Nick Ing-Simmons <nick@ni-s.u-net.com>
|
Math::Rand48 - perl bindings for drand48 family of random functions |