Class UniformRNG
- java.lang.Object
-
- dev.nm.stat.random.rng.univariate.uniform.UniformRNG
-
- All Implemented Interfaces:
RandomLongGenerator
,RandomNumberGenerator
,Seedable
public class UniformRNG extends Object implements RandomLongGenerator
A pseudo uniform random number generator samples numbers from the unit interval, [0, 1], in such a way that there are equal probabilities of them falling in any same length sub-interval. Sampling from the unit interval is the most basic building block of most pseudo random number generation algorithms.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
UniformRNG.Method
the pseudo uniform random number generators available
-
Constructor Summary
Constructors Constructor Description UniformRNG()
Construct a pseudo uniform random number generator.UniformRNG(long... seeds)
Construct a seeded pseudo uniform random number generator.UniformRNG(UniformRNG.Method method)
Construct a pseudo uniform random number generator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
nextDouble()
Get the next randomdouble
.long
nextLong()
Get the next randomlong
.void
seed(long... seeds)
Seed the random number/vector/scenario generator to produce repeatable experiments.
-
-
-
Constructor Detail
-
UniformRNG
public UniformRNG(UniformRNG.Method method)
Construct a pseudo uniform random number generator.- Parameters:
method
- the uniform random number generation algorithm to use
-
UniformRNG
public UniformRNG()
Construct a pseudo uniform random number generator.
-
UniformRNG
public UniformRNG(long... seeds)
Construct a seeded pseudo uniform random number generator.- Parameters:
seeds
- the seed(s)
-
-
Method Detail
-
seed
public void seed(long... seeds)
Description copied from interface:Seedable
Seed the random number/vector/scenario generator to produce repeatable experiments.
-
nextDouble
public double nextDouble()
Description copied from interface:RandomNumberGenerator
Get the next randomdouble
.- Specified by:
nextDouble
in interfaceRandomNumberGenerator
- Returns:
- the next random number
-
nextLong
public long nextLong()
Description copied from interface:RandomLongGenerator
Get the next randomlong
.- Specified by:
nextLong
in interfaceRandomLongGenerator
- Returns:
- the next random
long
-
-