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, a SeedException
is thrown.
- Author:
- Daniel Dyer
DevRandomSeedGenerator
public DevRandomSeedGenerator()
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 String toString()
- Overrides:
toString
in class Object