- Direct Known Subclasses:
- F2NL607, GenF2w32, LFSR113, LFSR258, MRG31k3p, MRG32k3a, MRG32k3aL, MT19937, RandRijndael, WELL1024, WELL512, WELL607
public abstract class RandomStreamBaseextends Objectimplements CloneableRandomStream, SerializableThis class provides a convenient foundation on which RNGs can be built. It implements all the methods which do not depend directly on the generator itself, but only on its output, which is to be defined by implementing the abstract method nextValue. In the present class, all methods returning random numbers directly or indirectly (nextDouble, nextArrayOfDouble, nextInt and nextArrayOfInt) call nextValue. Thus, to define a subclass that implements a RNG, it suffices to implement nextValue, in addition to the reset... and toString methods. Of course, the other methods may also be overridden for improved efficiency.
If the nextValue already generates numbers with a precision of 53-bits or higher, then
nextDoublecan be overridden to improve the performance. The mechanism for increasing the precision assumes that nextValue returns at least 29 bits of precision, in which case the higher precision numbers will have roughly 52 bits of precision. This mechanism was designed primarily for RNGs that return numbers with around 30 to 32 bits of precision.
RandomStreamBaseand its subclasses are implementing the
Serializableinterface. Each class has a serial number wich represent the class version. For instance 70510 means that the last change was the 10th May 2007.
- See Also:
- Serialized Form