Math::Random::MT::Auto 5.04 review
DownloadMath::Random::MT::Auto is a Perl module for auto-seeded Mersenne Twister PRNGs. SYNOPSIS use strict; use warnings; use Mat
|
|
Math::Random::MT::Auto is a Perl module for auto-seeded Mersenne Twister PRNGs.
SYNOPSIS
use strict;
use warnings;
use Math::Random::MT::Auto qw(rand irand shuffle gaussian),
'/dev/urandom' => 256,
'random_org';
# Functional interface
my $die_roll = 1 + int(rand(6));
my $coin_flip = (irand() & 1) ? 'heads' : 'tails';
my $deck = shuffle(1 .. 52);
my $rand_IQ = gaussian(15, 100);
# OO interface
my $prng = Math::Random::MT::Auto->new('SOURCE' => '/dev/random');
my $angle = $prng->rand(360);
my $decay_interval = $prng->exponential(12.4);
The Mersenne Twister is a fast pseudorandom number generator (PRNG) that is capable of providing large volumes (> 10^6004) of "high quality" pseudorandom data to applications that may exhaust available "truly" random data sources or system-provided PRNGs such as rand.
This module provides PRNGs that are based on the Mersenne Twister.
There is a functional interface to a single, standalone PRNG, and an OO interface (based on the inside-out object model as implemented by the Object::InsideOut module) for generating multiple PRNG objects. The PRNGs are self-seeding, automatically acquiring a (19968-bit) random seed from user-selectable sources.
Requirements:
Perl
Math::Random::MT::Auto 5.04 keywords