Package jadex.ipc.impl.security.random
Class SecureThreadedRandom
java.lang.Object
java.util.Random
java.security.SecureRandom
jadex.ipc.impl.security.random.SecureThreadedRandom
- All Implemented Interfaces:
Serializable
,RandomGenerator
Wrapper for quick multi-threaded PRNG access using multiple PRNGs.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.random.RandomGenerator
RandomGenerator.ArbitrarilyJumpableGenerator, RandomGenerator.JumpableGenerator, RandomGenerator.LeapableGenerator, RandomGenerator.SplittableGenerator, RandomGenerator.StreamableGenerator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SecureRandom[]
The random number generators.protected int
Mask for distributing threads. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
generateSeed
(int numbytes) Generates a seed value from OS source.boolean
Wrapper method.void
nextBytes
(byte[] bytes) Wrapper method.double
Wrapper method.float
Wrapper method.double
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
Methods inherited from class java.util.Random
doubles, doubles, doubles, doubles, from, ints, ints, ints, ints, longs, longs, longs, longs
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.random.RandomGenerator
isDeprecated, nextDouble, nextDouble, nextExponential, nextFloat, nextFloat, nextGaussian, nextInt, nextLong, nextLong
-
Field Details
-
prngs
The random number generators. -
threadingmask
protected int threadingmaskMask for distributing threads.
-
-
Constructor Details
-
SecureThreadedRandom
public SecureThreadedRandom()Creates the wrapper.
-
-
Method Details
-
nextBoolean
public boolean nextBoolean()Wrapper method.- Specified by:
nextBoolean
in interfaceRandomGenerator
- Overrides:
nextBoolean
in classRandom
-
nextBytes
public void nextBytes(byte[] bytes) Wrapper method.- Specified by:
nextBytes
in interfaceRandomGenerator
- Overrides:
nextBytes
in classSecureRandom
-
nextDouble
public double nextDouble()Wrapper method.- Specified by:
nextDouble
in interfaceRandomGenerator
- Overrides:
nextDouble
in classRandom
-
nextFloat
public float nextFloat()Wrapper method.- Specified by:
nextFloat
in interfaceRandomGenerator
- Overrides:
nextFloat
in classRandom
-
nextGaussian
public double nextGaussian()Wrapper method.- Specified by:
nextGaussian
in interfaceRandomGenerator
- Overrides:
nextGaussian
in classRandom
-
nextInt
public int nextInt()Wrapper method.- Specified by:
nextInt
in interfaceRandomGenerator
- Overrides:
nextInt
in classRandom
-
nextInt
public int nextInt(int bound) Wrapper method.- Specified by:
nextInt
in interfaceRandomGenerator
- Overrides:
nextInt
in classRandom
-
nextLong
public long nextLong()Wrapper method.- Specified by:
nextLong
in interfaceRandomGenerator
- Overrides:
nextLong
in classRandom
-
generateSeed
public byte[] generateSeed(int numbytes) Generates a seed value from OS source.- Overrides:
generateSeed
in classSecureRandom
-
setSeed
public void setSeed(long seed) Wrapper method. Warning: This is useless, included for completeness.- Overrides:
setSeed
in classSecureRandom
-