|
NAMEMath::Random::MT::Auto::Range - Range-valued PRNGsSYNOPSISuse strict; use warnings; use Math::Random::MT::Auto::Range; # Integer random number range my $die = Math::Random::MT::Auto::Range->new(LO => 1, HI => 6); my $roll = $die->rrand(); # Floating-point random number range my $compass = Math::Random::MT::Auto::Range->new(LO => 0, HI => 360, TYPE => 'DOUBLE'); my $course = $compass->rrand(); DESCRIPTIONThis module creates range-valued pseudorandom number generators (PRNGs) that return random values between two specified limits.While useful in itself, the primary purpose of this module is to provide an example of how to create subclasses of Math::Random::MT::Auto within Object::InsideOut's inside-out object model. MODULE DECLARATIONAdd the following to the top of our application code:use strict; use warnings; use Math::Random::MT::Auto::Range; This module is strictly OO, and does not export any functions or symbols. METHODS
The options above are also supported using lowercase and mixed-case (e.g., 'low', 'hi', 'Type', etc.). Additionally, objects created with this package can take any of the options supported by the Math::Random::MT::Auto class, namely, "STATE", "SEED" and "STATE".
In addition to the methods describe below, the objects created by this package inherit all the object methods provided by the Math::Random::MT::Auto class, including the "-"clone()> method.
INSIDE-OUT OBJECTSCapabilities provided by Object::InsideOut are supported by this modules. See "INSIDE-OUT OBJECTS" in Math::Random::MT::Auto for more information.CoercionObject coercion is supported in the same manner as documented in See "Coercion" in Math::Random::MT::Auto except that the underlying random number method is "->rrand()".DIAGNOSTICS
This module will reverse the range limits if they are specified in the wrong order (i.e., it makes sure that "LOW < HIGH"). SEE ALSOMath::Random::MT::AutoObject::InsideOut AUTHORJerry D. Hedden, <jdhedden AT cpan DOT org>COPYRIGHT AND LICENSECopyright 2005 - 2009 Jerry D. Hedden. All rights reserved.This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |