public abstract class AbstractFloatDistribution extends PersistentObject implements FloatFunction, IntFunction
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.
FloatMersenneTwister
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
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.tfloat.engine
,
Serialized FormModifier and Type | Method and Description |
---|---|
float |
apply(float dummy)
Equivalent to nextFloat().
|
int |
apply(int dummy)
Equivalent to nextInt().
|
Object |
clone()
Returns a deep copy of the receiver; the copy will produce identical
sequences.
|
static FloatRandomEngine |
makeDefaultGenerator()
Constructs and returns a new uniform random number generation engine
seeded with the current time.
|
abstract float |
nextFloat()
Returns a random number from the distribution.
|
int |
nextInt()
Returns a random number from the distribution; returns
(int) Math.round(nextFloat()).
|
public float apply(float dummy)
apply
in interface FloatFunction
dummy
- argument passed to the function.public int apply(int dummy)
apply
in interface IntFunction
dummy
- argument passed to the function.public Object clone()
clone
in class PersistentObject
public static FloatRandomEngine makeDefaultGenerator()
FloatMersenneTwister
.public abstract float nextFloat()
public int nextInt()
Jump to the Parallel Colt Homepage