GNU.WIKI: The GNU/Linux Knowledge Base

  [HOME] [PHP Manual] [HowTo] [ABS] [MAN1] [MAN2] [MAN3] [MAN4] [MAN5] [MAN6] [MAN7] [MAN8] [MAN9]

  [0-9] [Aa] [Bb] [Cc] [Dd] [Ee] [Ff] [Gg] [Hh] [Ii] [Jj] [Kk] [Ll] [Mm] [Nn] [Oo] [Pp] [Qq] [Rr] [Ss] [Tt] [Uu] [Vv] [Ww] [Xx] [Yy] [Zz]


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


       version 0.22


         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() . "
" ) for @prngs;


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


        $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

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

        $rnd = $prng->next();

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


       David Golden <>


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

       This is free software, licensed under:

         The Apache License, Version 2.0, January 2004

  All copyrights belong to their respective owners. Other content (c) 2014-2018, GNU.WIKI. Please report site errors to
Page load time: 0.319 seconds. Last modified: November 04 2018 12:49:43.