java.lang.Object
de.grogra.blocks.arrangeBlock.RandomGenerator
- All Implemented Interfaces:
ContinuousGenerator
,Seedable
A random number generator producing pseudorandom numbers based
on the value of a specific seed. The generator is a multiplicative
linear congruential generator. It generates numbers through the
following structure:
Y[1] = (742938285*Y[0]) mod (231-1)
The seed (Y[0]
) provided is used to generate a sequence of pseudorandom
numbers uniformly distributed between 0
and 1
. The cycle of the generator
is 231-2
.
- Version:
- 1.0, 2 October 2002
- Author:
- F.Mallet from Costas Simatos original
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
RandomGenerator
public RandomGenerator() -
RandomGenerator
public RandomGenerator(long seed)
-
-
Method Details
-
sample
public double sample()- Specified by:
sample
in interfaceContinuousGenerator
-
nextLong
public long nextLong()- Returns:
- The next long random number in the sequence
-
setSeed
public void setSeed(long seed) Description copied from interface:Seedable
Set the random number generator's seed. -
getSeed
public long getSeed()Description copied from interface:Seedable
Get the random number generator's seed. -
reseed
public void reseed()Description copied from interface:Seedable
Get another seed well-spaced (from the defaultSeedGenerator
)
-