Package org.uncommons.maths.random
Class DevRandomSeedGenerator
- java.lang.Object
-
- org.uncommons.maths.random.DevRandomSeedGenerator
-
- All Implemented Interfaces:
SeedGenerator
public class DevRandomSeedGenerator extends 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, aSeedException
is thrown.
-
-
Constructor Summary
Constructors Constructor Description DevRandomSeedGenerator()
-
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.String
toString()
-
-
-
Method Detail
-
generateSeed
public byte[] generateSeed(int length) throws SeedException
Generate a seed value for a random number generator.- Specified by:
generateSeed
in interfaceSeedGenerator
- 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
-
-