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 intMask 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 TypeMethodDescriptionbooleanWrapper method.voidnextBytes(byte[] bytes) Wrapper method.doubleWrapper method.floatWrapper method.doubleWrapper method.intnextInt()Wrapper method.intnextInt(int bound) Wrapper method.longnextLong()Wrapper method.voidsetSeed(long seed) Wrapper method.Methods inherited from class java.util.Random
doubles, doubles, doubles, doubles, ints, ints, ints, ints, longs, longs, longs, longs, nextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
nextBooleanin interfaceRandomGenerator- Overrides:
nextBooleanin classRandom
-
nextBytes
public void nextBytes(byte[] bytes) Wrapper method.- Specified by:
nextBytesin interfaceRandomGenerator- Overrides:
nextBytesin classRandom
-
nextDouble
public double nextDouble()Wrapper method.- Specified by:
nextDoublein interfaceRandomGenerator- Overrides:
nextDoublein classRandom
-
nextFloat
public float nextFloat()Wrapper method.- Specified by:
nextFloatin interfaceRandomGenerator- Overrides:
nextFloatin classRandom
-
nextGaussian
public double nextGaussian()Wrapper method.- Specified by:
nextGaussianin interfaceRandomGenerator- Overrides:
nextGaussianin classRandom
-
nextInt
public int nextInt()Wrapper method.- Specified by:
nextIntin interfaceRandomGenerator- Overrides:
nextIntin classRandom
-
nextInt
public int nextInt(int bound) Wrapper method.- Specified by:
nextIntin interfaceRandomGenerator- Overrides:
nextIntin classRandom
-
nextLong
public long nextLong()Wrapper method.- Specified by:
nextLongin interfaceRandomGenerator- Overrides:
nextLongin classRandom
-
setSeed
public void setSeed(long seed) Wrapper method. Warning: This is useless, included for completeness.
-