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
Math::Random::OO::Normal(3) User Contributed Perl Documentation Math::Random::OO::Normal(3)

Math::Random::OO::Normal - Generates random numbers from the normal (Gaussian) distribution

version 0.22

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

This subclass of Math::Random::OO generates random reals from the normal probability distribution, also called the Gaussian or bell-curve distribution.

The module generates random normals from the inverse of the cumulative normal distribution using an approximation algorithm developed by Peter J. Acklam and released into the public domain. This algorithm claims a relative error of less than 1.15e-9 over the entire region.

See http://home.online.no/~pjacklam/notes/invnorm/ for details and discussion.

 $prng1 = Math::Random::OO::Normal->new();
 $prng2 = Math::Random::OO::Normal->new($mean);
 $prng3 = Math::Random::OO::Normal->new($mean,$stdev);

"new" takes up to two optional parameters and returns a new "Math::Random::OO::Normal" object. With no parameters, the object generates random numbers from the standard normal distribution (mean zero, standard deviation one). With a single parameter, the object generates random numbers with mean equal to the parameter and standard deviation of one. With two parameters, the object generates random numbers with mean equal to the first parameter and standard deviation equal to the second parameter. (Standard deviation should be positive, but this module takes the absolute value of the parameter just in case.)

 $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 <dagolden@cpan.org>

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

This is free software, licensed under:

  The Apache License, Version 2.0, January 2004
2013-06-09 perl v5.32.1

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

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