ImageScience 3.0.0

imagescience.random
Class UniformGenerator

java.lang.Object
  extended by imagescience.random.UniformGenerator
All Implemented Interfaces:
RandomGenerator

public class UniformGenerator
extends java.lang.Object
implements RandomGenerator

Uniform random number generator. Implementation of the so-called Mersenne Twister described by M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions on Modeling and Computer Simulation, vol. 8, no. 1, January 1998, pp. 3-30. It is one of the strongest uniform pseudo-random number generators known to date, with a period of 2^19937 - 1. This Java implementation is based on the 26 January 2002 C-version provided on the linked website and has been validated by comparing the output for different (positive and negative) integer test seeds.


Constructor Summary
UniformGenerator()
          Constructs a generator of random numbers uniformly distributed in the open interval (0,1) and initialized with a random seed.
UniformGenerator(double min, double max)
          Constructs a generator of random numbers uniformly distributed in the open interval (min,max) and initialized with a random seed.
UniformGenerator(double min, double max, int seed)
          Constructs a generator of random numbers uniformly distributed in the open interval (min,max) and initialized with the given seed.
UniformGenerator(int seed)
          Constructs a generator of random numbers uniformly distributed in the open interval (0,1) and initialized with the given seed.
 
Method Summary
 double next()
          Returns a uniform random number in the interval specified at construction.
 double next(double min, double max)
          Returns a uniform random number in the open interval (min,max).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UniformGenerator

public UniformGenerator()
Constructs a generator of random numbers uniformly distributed in the open interval (0,1) and initialized with a random seed.


UniformGenerator

public UniformGenerator(int seed)
Constructs a generator of random numbers uniformly distributed in the open interval (0,1) and initialized with the given seed.

Parameters:
seed - The seed used for initialization of the generator.

UniformGenerator

public UniformGenerator(double min,
                        double max)
Constructs a generator of random numbers uniformly distributed in the open interval (min,max) and initialized with a random seed.

Parameters:
min - max - The interval parameters. Random numbers are generated in the open interval (min,max). If min > max, the meaning of the parameters is automatically reversed.

UniformGenerator

public UniformGenerator(double min,
                        double max,
                        int seed)
Constructs a generator of random numbers uniformly distributed in the open interval (min,max) and initialized with the given seed.

Parameters:
min - max - The interval parameters. Random numbers are generated in the open interval (min,max). If min > max, the meaning of the parameters is automatically reversed.
seed - The seed used for initialization of the generator.
Method Detail

next

public double next()
Returns a uniform random number in the interval specified at construction.

Specified by:
next in interface RandomGenerator
Returns:
A uniform random number in the interval specified at construction.

next

public double next(double min,
                   double max)
Returns a uniform random number in the open interval (min,max).

Parameters:
min - max - The interval parameters. Random numbers are generated in the open interval (min,max). If min > max, the meaning of the parameters is automatically reversed.

ImageScience 3.0.0

Copyright (C) Erik Meijering. Permission to use this software and corresponding documentation for educational, research, and not-for-profit purposes, without a fee and without a signed licensing agreement, is granted, subject to the following terms and conditions.

IT IS NOT ALLOWED TO REDISTRIBUTE, SELL, OR LEASE THIS SOFTWARE, OR DERIVATIVE WORKS THEREOF, WITHOUT PERMISSION IN WRITING FROM THE COPYRIGHT HOLDER. THE COPYRIGHT HOLDER IS FREE TO MAKE VERSIONS OF THE SOFTWARE AVAILABLE FOR A FEE OR COMMERCIALLY ONLY.

IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OF ANY KIND WHATSOEVER, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.

THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE EXPRESS OR IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND CORRESPONDING DOCUMENTATION IS PROVIDED "AS IS". THE COPYRIGHT HOLDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.