Mcrypt - Perl extension for a Mersenne Twister PRGN implementation with context.
use Rand::MersenneTwister; # Object-oriented methods # New object context optionally seeded. $r = Rand::MersenneTwister->new( [$seed] ); # Seed or reseed this PRNG context. $r->seed($number); # fetch the next random number in the sequance. # between 0 and 1 my $random_number = $r->rand; # between 0 and $v my $random_number = $r->rand($v); # If the $r goes out of context, it is freed.
This module wraps a fast, C implementation of a Mersenne Twister-based PRNG. =head1 Exported constants
The predefined groups of exports in the use statements are as follows:
use Rand::MersenneTwister;
Exports the following functions: mt_init, mt_free, mt_seed, mt_rand.
use Rand::MersenneTwister; my $r = Rand::MersenneTwister->new(); $r->seed(); my $randmon_number = $r->rand(100);
George Schlossnagle <george@omniti.com> Theo Schlossnagle <jesus@omniti.com>
http://www.math.keio.ac.jp/~matumoto/mt.html
For the less worldly:
http://www.math.keio.ac.jp/~matumoto/emt.html
To install Rand::MersenneTwister, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Rand::MersenneTwister
CPAN shell
perl -MCPAN -e shell install Rand::MersenneTwister
For more information on module installation, please visit the detailed CPAN module installation guide.