public abstract class AbstractDistribution
extends java.lang.Object
implements java.io.Serializable
Currently all subclasses use a uniform pseudo-random number generation engine and transform its results to the target distribution. Thus, they expect such a uniform engine upon instance construction.
cern.jet.random.engine.MersenneTwister
is recommended as uniform pseudo-random number generation engine, since it is very strong and at the same time quick.
#makeDefaultGenerator()
will conveniently construct and return such a magic thing.
You can also, for example, use cern.jet.random.engine.DRand
, a quicker (but much weaker) uniform random number generation engine.
Of course, you can also use other strong uniform random number generation engines.
Ressources on the Web:
Other useful ressources:
cern.jet.random.engine
,
cern.jet.random.engine.Benchmark
,
cern.jet.random.Benchmark
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected MersenneTwisterFast |
randomGenerator |
Modifier | Constructor and Description |
---|---|
protected |
AbstractDistribution()
Makes this class non instantiable, but still let's others inherit from it.
|
Modifier and Type | Method and Description |
---|---|
double |
apply(double dummy)
Equivalent to nextDouble().
|
int |
apply(int dummy)
Equivalent to nextInt().
|
protected MersenneTwisterFast |
getRandomGenerator()
Returns the used uniform random number generator;
|
abstract double |
nextDouble()
Returns a random number from the distribution.
|
int |
nextInt()
Returns a random number from the distribution; returns (int) Math.round(nextDouble()).
|
protected void |
setRandomGenerator(MersenneTwisterFast randomGenerator)
Sets the uniform random generator internally used.
|
protected MersenneTwisterFast randomGenerator
protected AbstractDistribution()
public double apply(double dummy)
public int apply(int dummy)
protected MersenneTwisterFast getRandomGenerator()
public abstract double nextDouble()
public int nextInt()
protected void setRandomGenerator(MersenneTwisterFast randomGenerator)