Class DevRandomSeedGenerator

  • All Implemented Interfaces:
    SeedGenerator

    public class DevRandomSeedGenerator
    extends java.lang.Object
    implements SeedGenerator
    RNG seed strategy that gets data from /dev/random on systems that provide it (e.g. Solaris/Linux). If /dev/random does not exist or is not accessible, a SeedException is thrown.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.io.File DEV_RANDOM  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] generateSeed​(int length)
      Generate a seed value for a random number generator.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • DEV_RANDOM

        private static final java.io.File DEV_RANDOM
    • Constructor Detail

      • DevRandomSeedGenerator

        public DevRandomSeedGenerator()
    • Method Detail

      • generateSeed

        public byte[] generateSeed​(int length)
                            throws SeedException
        Generate a seed value for a random number generator.
        Specified by:
        generateSeed in interface SeedGenerator
        Parameters:
        length - The length of the seed to generate (in bytes).
        Returns:
        The requested number of random bytes, read directly from /dev/random.
        Throws:
        SeedException - If /dev/random does not exist or is not accessible
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object