Syntax-K

Know-How für Ihr Projekt

Perl Documentation

NAME

Math::Random::MT::Auto::Range - Range-valued PRNGs

SYNOPSIS

use 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();

DESCRIPTION

This 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 DECLARATION

Add 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

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 OBJECTS

Capabilities provided by Object::InsideOut are supported by this modules. See "INSIDE-OUT OBJECTS" in Math::Random::MT::Auto for more information.

Coercion

Object 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 ALSO

Math::Random::MT::Auto

Object::InsideOut

AUTHOR

Jerry D. Hedden, pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp

COPYRIGHT AND LICENSE

Copyright 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.