Class HighEntropyRandomNumberGenerator

All Implemented Interfaces:
Serializable, DoubleSupplier, RandomNumberGenerator, RandomNumberGenerator1D

public class HighEntropyRandomNumberGenerator extends Object implements RandomNumberGenerator1D
Wrapper class for Usage of this class is not recommended for normal operations. There are reported cases in the literature where some pseudorandom number generators might fail in heavily multithreaded applications and lose their statistical properties. This class wraps a cryptography grade RNG based on the system entropy pool (eg. /dev/random on *nix systems) which does not suffer from the same issue. Performance is up to 30x slower than a regular software based PRNG.
Luca Bressan
See Also:
  • Constructor Details

    • HighEntropyRandomNumberGenerator

      public HighEntropyRandomNumberGenerator()
    • HighEntropyRandomNumberGenerator

      public HighEntropyRandomNumberGenerator(SecureRandom secureRandomNumberGenerator)
      This constructor accepts an object from classes that extend It is meant to provide a way to integrate hardware RNG functionality or as a clone constructor. You should supply an object instantiating the extending class that uses the JNI to achieve the desired functionality.
      secureRandomNumberGenerator - the object that will be wrapped.
  • Method Details

    • nextDouble

      public double nextDouble()
      Returns the next random number in the sequence.
      Specified by:
      nextDouble in interface RandomNumberGenerator1D
      the next random number in the sequence.
    • nextDoubleFast

      public double nextDoubleFast()
      Description copied from interface: RandomNumberGenerator1D
      Possibly faster, non-thread safe implementation returning the next double value of this random number generator. The user of this method has to ensure synchronization if this generator is shared by different threads.
      Specified by:
      nextDoubleFast in interface RandomNumberGenerator1D
      The next double value of this random number generator
    • toString

      public String toString()
      toString in class Object