Math::RngStream - Perl wrapper for the RngStreams library |
Math::RngStream - Perl wrapper for the RngStreams library
use Math::RngStream;
my $rs = Math::RngStream->new; my $n = $rs->rand; my $int = $rs->rand_int(10, 20);
This module wraps the RngStreams library, a package for generating multiple independent streams of pseudo-random numbers.
This package has an object oriented interface:
This will be the seed (initial state) of the first stream. If this procedure is not called, the default initial seed is (12345, 12345, 12345, 12345, 12345, 12345).
The first 3 values of the seed must all be less than 4294967087, and not all 0; and the last 3 values must all be less than 4294944443, and not all 0.
new($name)
its seed is equal to the initial seed of the package given by set_package_seed if this is the first stream created, otherwise it is Z steps ahead of that of the most recently created stream.
set_antithetic($anti)
By default, the streams are created with $anti=0.
set_increased_precis($incp)
rand
will advance the state of the stream by 2
steps instead of 1, and will return a number with (roughly) 53 bits of
precision instead of 32 bits.
set_package_seed
.
Usage of this method is discouraged!
Usage of this method is discouraged!
set_increased_precis
has been
called for this stream.
rand_u01
.
RngStreams website and documentation: http://statmath.wu-wien.ac.at/software/RngStreams/
Before installing this module, you have to download, compile and install the RngStreams library available from its website.
Then, you have to follow the standard Perl module installation procedure:
perl Makefile.PL make make test make install
Or if you have installed the C library in a non standard place:
perl Makefile.PL \ RNGSTREAMS_INCLUDE=/path/to/rngstreams/include \ RNGSTREAMS_LIB=/path/to/rngstreams/lib make make test make install
Copyright (C) 2008 by Salvador Fandino (sfandino@yahoo.com)
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
This module documentation is based on the RngStreams original documentation Copyright (C) 2003 Pierre L'Ecuyer, DIRO, University of Montreal.
The RngStreams library is distributed under the GPL. Copyright (C) 2003 Pierre L'Ecuyer, DIRO, University of Montreal.
Math::RngStream - Perl wrapper for the RngStreams library |