Search
Documents
Math::Rand48 - perl bindings for drand48 family of random functions (Displayed) README
|
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.
seed48
-
Returns the current seed used by
drand48, lrand48, mrand48.
If given an argument sets the seed to that value.
drand48
erand48($seed)
-
Return float value in range [0.0,1.0).
Multiple independent streams of numbers can be obtained using
erand48.
lrand48
nrand48($seed)
-
Return integer in range [0,2**31).
Multiple independent streams of numbers can be obtained using
nrand48.
mrand48
jrand48($seed)
-
Return integer in range [-2**31,2**31).
Multiple independent streams of numbers can be obtained using
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>
Information
|
This site is currently in testing, it is not yet operating using the full database. Until it is officially launched you may wish to visit Help-Site Computer Manuals. After launch, this site (HelpSpy) will replace Help-Site. Information about the spider which is currently trawling the Internet looking for links to add to this directory can be found here. |
|
|