GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  MATH::RANDOM::OO::UNIFORM (3)

.ds Aq ’

NAME

Math::Random::OO::Uniform - Generates random numbers from the uniform distribution

CONTENTS

VERSION

version 0.22

SYNOPSIS



  use Math::Random::OO::Uniform;
  push @prngs,
      Math::Random::OO::Uniform->new(),     # range [0,1)
      Math::Random::OO::Uniform->new(5),    # range [0,5)
      Math::Random::OO::Uniform->new(-1,1); # range [-1,1)
  $_->seed(42) for @prngs;
  print( $_->next() . "\n" ) for @prngs;



DESCRIPTION

This subclass of Math::Random::OO generates random reals from a uniform probability distribution.

METHODS

CWnew



 $prng1 = Math::Random::OO::Uniform->new();
 $prng2 = Math::Random::OO::Uniform->new($high);
 $prng3 = Math::Random::OO::Uniform->new($low,$high);



new takes up to two optional parameters and returns a new Math::Random::OO::Uniform object. With no parameters, the object generates random numbers in the range of zero (inclusive) to one (exclusive). With a single parameter, the object generates random numbers from zero (inclusive) to the value of the parameter (exclusive). Note, the object does this with multiplication, so if the parameter is negative, the function will return negative numbers. This is a feature or bug, depending on your point of view. With two parameters, the object generates random numbers from the first parameter (inclusive) to the second parameter (exclusive). (Actually, as long as you have two parameters, new will put them in the right order).

CWseed



 $rv = $prng->seed( @seeds );



This method seeds the random number generator. At the moment, only the first seed value matters. It should be a positive integer.

CWnext



 $rnd = $prng->next();



This method returns the next random number from the random number generator. It does not take any parameters.

AUTHOR

David Golden <dagolden@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2013 by David Golden.

This is free software, licensed under:



  The Apache License, Version 2.0, January 2004



Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 MATH::RANDOM::OO::UNIFORM (3) 2013-06-09

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.