Interface SeedGenerator
- 
- All Superinterfaces:
- Serializable
 - All Known Implementing Classes:
- BufferedSeedGenerator,- DefaultSeedGenerator,- DevRandomSeedGenerator,- RandomDotOrgSeedGenerator,- SecureRandomSeedGenerator,- SeedGeneratorPreferenceList
 
 public interface SeedGenerator extends Serializable Strategy interface for seeding random number generators. Implementations that can have multiple equivalent instances that contend for a resource should implementObject.equals(Object)andObject.hashCode()to help with de-duplication ofSimpleRandomSeederinstances.- Author:
- Daniel Dyer, Chris Hennick
 
- 
- 
Field SummaryFields Modifier and Type Field Description static byte[]EMPTY_SEEDAn empty byte array.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description voidgenerateSeed(byte[] output)Generates a seed value for a random number generator in an existing array.byte[]generateSeed(int length)Generates and returns a seed value for a random number generator as a new array.booleanisWorthTrying()Returns true if we cannot determine quickly (i.e.
 
- 
- 
- 
Method Detail- 
generateSeedvoid generateSeed(byte[] output) throws SeedExceptionGenerates 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.
 
 - 
generateSeedbyte[] generateSeed(int length) throws SeedExceptionGenerates 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.
 
 - 
isWorthTryingboolean isWorthTrying() Returns true if we cannot determine quickly (i.e. without I/O calls) that this SeedGenerator would throw aSeedExceptionifgenerateSeed(int)orgenerateSeed(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.
 
 
- 
 
-