All Packages Class Hierarchy This Package Previous Next Index
Class jnt.random.UniformSequence
java.lang.Object

+jnt.random.UniformSequence
 public class UniformSequence
 extends Object
Provides a sequence of uniformly distributed quasi random numbers.
By default the numbers are drawn from the interval [0,1). The interval can
be changed using the constructor. The user may also specify an integer seed
for the sequence; sequences with the same seed are identical. If no seed is
specified by the user, then a seed based on the system clock is used, which
should provide a new sequence on subsequent constructions. (Beware: two
sequences constructed within the clock resolution  a millisecond  could
be identical, and so providing your own seed is generally preferable.)
This class is a translation of the Fortran subroutine UNI from the NBS Core
Math Library. UNI was written by James Blue, David Kahanaer and George
Marsaglia.
This generator is of the lagged Fibbonacci type.
 Example of use:
 Print 20 random numbers on [1,1).
int i, seed = 687346;
double left = 1.0, right = 1.0;
UniformSequence random;
random = new UniformSequence( seed, left, right );
for (i=0, i<20, i++) System.out.println( random.next() );
 Version:
 3 December 1997
 Author:
 Ronald F. Boisvert, NIST
 See Also:
 LongUniformSequence

UniformSequence()
 Initializes a sequence of uniformly distributed quasi random numbers with a
seed based on the system clock.

UniformSequence(double, double)
 Initializes a sequence of uniformly distributed quasi random numbers on a
given halfopen interval [left,right) with a seed based on the system
clock.

UniformSequence(int)
 Initializes a sequence of uniformly distributed quasi random numbers with a
given seed.

UniformSequence(int, double, double)
 Initializes a sequence of uniformly distributed quasi random numbers
with a given seed on a given halfopen interval [left,right).

next()
 Returns the next random number in the sequence.
UniformSequence
public UniformSequence()
 Initializes a sequence of uniformly distributed quasi random numbers with a
seed based on the system clock.
UniformSequence
public UniformSequence(double left,
double right)
 Initializes a sequence of uniformly distributed quasi random numbers on a
given halfopen interval [left,right) with a seed based on the system
clock.
 Parameters:
 left  (double)
The left endpoint of the halfopen interval [left,right).
 right  (double)
The right endpoint of the halfopen interval [left,right).
UniformSequence
public UniformSequence(int seed)
 Initializes a sequence of uniformly distributed quasi random numbers with a
given seed.
 Parameters:
 seed  (int)
The seed of the random number generator. Two sequences with the same
seed will be identical.
UniformSequence
public UniformSequence(int seed,
double left,
double right)
 Initializes a sequence of uniformly distributed quasi random numbers
with a given seed on a given halfopen interval [left,right).
 Parameters:
 seed  (int)
The seed of the random number generator. Two sequences with the same
seed will be identical.
 left  (double)
The left endpoint of the halfopen interval [left,right).
 right  (double)
The right endpoint of the halfopen interval [left,right).
next
public double next()
 Returns the next random number in the sequence.
All Packages Class Hierarchy This Package Previous Next Index