Package jadex.commons.security.random
Class SecureThreadedRandom
- java.lang.Object
-
- java.util.Random
-
- java.security.SecureRandom
-
- jadex.commons.security.random.SecureThreadedRandom
-
- All Implemented Interfaces:
java.io.Serializable
public class SecureThreadedRandom extends java.security.SecureRandom
Wrapper for quick multi-threaded PRNG access using multiple PRNGs.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.security.SecureRandom[]
prngs
The random number generators.protected int
threadingmask
Mask for distributing threads.
-
Constructor Summary
Constructors Constructor Description SecureThreadedRandom()
Creates the wrapper.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
generateSeed(int numbytes)
Generates a seed value from OS source.boolean
nextBoolean()
Wrapper method.void
nextBytes(byte[] bytes)
Wrapper method.double
nextDouble()
Wrapper method.float
nextFloat()
Wrapper method.double
nextGaussian()
Wrapper method.int
nextInt()
Wrapper method.int
nextInt(int bound)
Wrapper method.long
nextLong()
Wrapper method.void
setSeed(long seed)
Wrapper method.-
Methods inherited from class java.security.SecureRandom
getAlgorithm, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstanceStrong, getParameters, getProvider, getSeed, next, nextBytes, reseed, reseed, setSeed, toString
-
-
-
-
Method Detail
-
nextBoolean
public boolean nextBoolean()
Wrapper method.- Overrides:
nextBoolean
in classjava.util.Random
-
nextBytes
public void nextBytes(byte[] bytes)
Wrapper method.- Overrides:
nextBytes
in classjava.security.SecureRandom
-
nextDouble
public double nextDouble()
Wrapper method.- Overrides:
nextDouble
in classjava.util.Random
-
nextFloat
public float nextFloat()
Wrapper method.- Overrides:
nextFloat
in classjava.util.Random
-
nextGaussian
public double nextGaussian()
Wrapper method.- Overrides:
nextGaussian
in classjava.util.Random
-
nextInt
public int nextInt()
Wrapper method.- Overrides:
nextInt
in classjava.util.Random
-
nextInt
public int nextInt(int bound)
Wrapper method.- Overrides:
nextInt
in classjava.util.Random
-
nextLong
public long nextLong()
Wrapper method.- Overrides:
nextLong
in classjava.util.Random
-
generateSeed
public byte[] generateSeed(int numbytes)
Generates a seed value from OS source.- Overrides:
generateSeed
in classjava.security.SecureRandom
-
setSeed
public void setSeed(long seed)
Wrapper method. Warning: This is useless, included for completeness.- Overrides:
setSeed
in classjava.security.SecureRandom
-
-