Package org.anchoranalysis.core.random
Class RandomNumberGeneratorMersenne
Object
RandomNumberGeneratorMersenne
- All Implemented Interfaces:
RandomNumberGenerator
Implements a random-number generator using the
MersenneTwister
algorithm.
Either one fixed constant-seed or the system clock will be used as a seed.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionRandomNumberGeneratorMersenne
(boolean fixedSeed) Creates indicating whether to use a fixed-seed or not. -
Method Summary
Modifier and TypeMethodDescriptioncern.jet.random.Normal
generateNormal
(double mean, double standardDeviation) Generates a Gaussian (Normal) random variable with particular parameterization.cern.jet.random.Poisson
generatePoisson
(double param) Generates a Poisson random variable with particular parameterization.double
Samples from a uniformly-distributed range between 0.0 (exclusive) and 1.0 (exclusive).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.anchoranalysis.core.random.RandomNumberGenerator
sampleDoubleFromRange, sampleDoubleFromRange, sampleDoubleFromZeroCenteredRange, sampleFromList, sampleIntFromRange, sampleIntFromRange, sampleLongFromRange
-
Constructor Details
-
RandomNumberGeneratorMersenne
public RandomNumberGeneratorMersenne(boolean fixedSeed) Creates indicating whether to use a fixed-seed or not.- Parameters:
fixedSeed
- if true, a fixed constant-seed. if false, the seed is the system clock.
-
-
Method Details
-
sampleDoubleZeroAndOne
public double sampleDoubleZeroAndOne()Description copied from interface:RandomNumberGenerator
Samples from a uniformly-distributed range between 0.0 (exclusive) and 1.0 (exclusive).- Specified by:
sampleDoubleZeroAndOne
in interfaceRandomNumberGenerator
- Returns:
- the randomly-sampled number.
-
generatePoisson
public cern.jet.random.Poisson generatePoisson(double param) Description copied from interface:RandomNumberGenerator
Generates a Poisson random variable with particular parameterization.- Specified by:
generatePoisson
in interfaceRandomNumberGenerator
- Parameters:
param
- the single parameter for the distribution.- Returns:
- a random-distribution from which sampling can occur.
-
generateNormal
public cern.jet.random.Normal generateNormal(double mean, double standardDeviation) Description copied from interface:RandomNumberGenerator
Generates a Gaussian (Normal) random variable with particular parameterization.- Specified by:
generateNormal
in interfaceRandomNumberGenerator
- Parameters:
mean
- mean parameter for the distributionstandardDeviation
- standard-deviation parameter for the distribution- Returns:
- a random-distribution from which sampling can occur.
-