Interface SeedGenerator

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static byte[] EMPTY_SEED
      An empty byte array.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void generateSeed​(byte[] output)
      Generates a seed value for a random number generator in an existing array.
      default byte[] generateSeed​(int length)
      Generates and returns a seed value for a random number generator as a new array.
      default boolean isWorthTrying()
      Returns true if we cannot determine quickly (i.e.
    • Field Detail

      • EMPTY_SEED

        static final byte[] EMPTY_SEED
        An empty byte array.
    • Method Detail

      • generateSeed

        void generateSeed​(byte[] output)
                   throws SeedException
        Generates a seed value for a random number generator in an existing array.
        Parameters:
        output - The array that is to be populated with the seed.
        Throws:
        SeedException - If a seed cannot be generated for any reason.
      • generateSeed

        default byte[] generateSeed​(int length)
                             throws SeedException
        Generates and returns a seed value for a random number generator as a new array.
        Parameters:
        length - The length of the seed to generate (in bytes).
        Returns:
        A byte array containing the seed data.
        Throws:
        SeedException - If a seed cannot be generated for any reason.
      • isWorthTrying

        default boolean isWorthTrying()
        Returns true if we cannot determine quickly (i.e. without I/O calls) that this SeedGenerator would throw a SeedException if generateSeed(int) or generateSeed(byte[]) were being called right now.
        Returns:
        true if this SeedGenerator will get as far as an I/O call or other slow operation in attempting to generate a seed immediately.