Class SeedGeneratorPreferenceList
- java.lang.Object
- 
- io.github.pr0methean.betterrandom.seed.SeedGeneratorPreferenceList
 
- 
- All Implemented Interfaces:
- SeedGenerator,- Serializable
 
 public class SeedGeneratorPreferenceList extends Object implements SeedGenerator ASeedGeneratorimplementation that iterates over multiple delegates until one succeeds.- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classSeedGeneratorPreferenceList.Builder
 - 
Field Summary- 
Fields inherited from interface io.github.pr0methean.betterrandom.seed.SeedGeneratorEMPTY_SEED
 
- 
 - 
Constructor SummaryConstructors Constructor Description SeedGeneratorPreferenceList(boolean isAlwaysWorthTrying, SeedGenerator... contents)Creates an instance.SeedGeneratorPreferenceList(Collection<? extends SeedGenerator> delegates, boolean isAlwaysWorthTrying)Creates an instance.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)voidgenerateSeed(byte[] output)Generates a seed value for a random number generator in an existing array.inthashCode()booleanisWorthTrying()Returns true if we cannot determine quickly (i.e.- 
Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface io.github.pr0methean.betterrandom.seed.SeedGeneratorgenerateSeed
 
- 
 
- 
- 
- 
Constructor Detail- 
SeedGeneratorPreferenceListpublic SeedGeneratorPreferenceList(Collection<? extends SeedGenerator> delegates, boolean isAlwaysWorthTrying) Creates an instance.- Parameters:
- delegates- the list of delegates, in the order they will be tried until one succeeds
- isAlwaysWorthTrying- true if- isWorthTrying()should always return true rather than delegating
 
 - 
SeedGeneratorPreferenceListpublic SeedGeneratorPreferenceList(boolean isAlwaysWorthTrying, SeedGenerator... contents)Creates an instance.- Parameters:
- contents- the initial delegates, in the order they will be tried until one succeeds
- isAlwaysWorthTrying- true if- isWorthTrying()should always return true rather than delegating
 
 
- 
 - 
Method Detail- 
generateSeedpublic void generateSeed(byte[] output) throws SeedExceptionDescription copied from interface:SeedGeneratorGenerates a seed value for a random number generator in an existing array.- Specified by:
- generateSeedin interface- SeedGenerator
- Parameters:
- output- The array that is to be populated with the seed.
- Throws:
- SeedException- If a seed cannot be generated for any reason.
 
 - 
isWorthTryingpublic boolean isWorthTrying() Description copied from interface:SeedGeneratorReturns true if we cannot determine quickly (i.e. without I/O calls) that this SeedGenerator would throw aSeedExceptionifSeedGenerator.generateSeed(int)orSeedGenerator.generateSeed(byte[])were being called right now.- Specified by:
- isWorthTryingin interface- SeedGenerator
- 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.
 
 
- 
 
-