|
ImageScience 3.0.0 | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectimagescience.random.UniformGenerator
public class UniformGenerator
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 |
---|
public UniformGenerator()
(0,1)
and initialized with a random seed.
public UniformGenerator(int seed)
(0,1)
and initialized with the given seed
.
seed
- The seed used for initialization of the generator.public UniformGenerator(double min, double max)
(min,max)
and initialized with a random seed.
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.public UniformGenerator(double min, double max, int seed)
(min,max)
and initialized with the given seed
.
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 |
---|
public double next()
next
in interface RandomGenerator
public double next(double min, double max)
(min,max)
.
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 | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.