- All Implemented Interfaces:
public abstract class RandomSeedableextends RandomElement
RandomSeedableis an abstract class that extends the
RandomElementclass to include the ability to automatically generate a valid
longseed from the clock. Thus it provides a consistent interface for seeding interchangable generators. It is reccomended that a
RandomSeedablehave a constructor that takes a
longfor a seed. For example, if you write a generator called
ReallyRandom, you want to be able to do
long seed=ReallyRandom.ClockSeed(); RandomSeedable e=new ReallyRandom(seed);this makes it convenient to keep a copy of the seed in case you want to restart the generator with the same seed some time in the future.
If one is going to use a long to generate a smaller seed by taking
Clockseed()modulus another number, we reccomend that you use a prime number; this ensures that the generator would have the maximum "period" if it were started at regular issues, for instance, by a batch job. See
Ranmarfor an example.
Source code is available.