Package jadex.common
Class FastThreadedRandom
java.lang.Object
java.util.Random
jadex.common.FastThreadedRandom
- 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 Random[]
The random number generators.protected int
Mask for distributing threads. -
Constructor Summary
ConstructorsConstructorDescriptionCreates the wrapper.FastThreadedRandom
(Class<?> randomclazz) Creates the wrapper.FastThreadedRandom
(Class<?> randomclazz, int threadinglevel) Creates the wrapper. -
Method Summary
Modifier and TypeMethodDescriptionboolean
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.util.Random
doubles, doubles, doubles, doubles, from, ints, ints, ints, ints, longs, longs, longs, longs, next
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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
-
FastThreadedRandom
public FastThreadedRandom()Creates the wrapper. -
FastThreadedRandom
Creates the wrapper. -
FastThreadedRandom
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 classRandom
-
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
-
setSeed
public void setSeed(long seed) Wrapper method. Warning: This is useless, included for completeness.
-