Class Randomness
- java.lang.Object
-
- com.carrotsearch.randomizedtesting.Randomness
-
public final class Randomness extends java.lang.Object
Per-thread, per-lifecycle state randomness defined as an initial seed and the current Random instance.An instance of this class will be typically available from
RandomizedContext
. No need to instantiate manually.- See Also:
RandomizedContext
-
-
Field Summary
Fields Modifier and Type Field Description private SeedDecorator[]
decorators
private java.util.Random
random
private long
seed
private RandomSupplier
supplier
-
Constructor Summary
Constructors Constructor Description Randomness(long seed, RandomSupplier supplier, SeedDecorator... decorators)
Randomness(java.lang.Thread owner, RandomSupplier supplier, long seed, SeedDecorator... decorators)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) Randomness
clone(java.lang.Thread newOwner)
private static long
decorate(long seed, SeedDecorator[] decorators)
Decorate a given seed.(package private) void
destroy()
Invalidate the underling randomness.(package private) SeedDecorator[]
getDecorators()
java.util.Random
getRandom()
Random instance for this randomness.(package private) RandomSupplier
getRandomSupplier()
(package private) long
getSeed()
Starting seed, read-only for tests.java.lang.String
toString()
-
-
-
Field Detail
-
seed
private final long seed
-
random
private final java.util.Random random
-
supplier
private final RandomSupplier supplier
-
decorators
private final SeedDecorator[] decorators
-
-
Constructor Detail
-
Randomness
public Randomness(java.lang.Thread owner, RandomSupplier supplier, long seed, SeedDecorator... decorators)
-
Randomness
public Randomness(long seed, RandomSupplier supplier, SeedDecorator... decorators)
-
-
Method Detail
-
getRandom
public java.util.Random getRandom()
Random instance for this randomness.
-
getRandomSupplier
RandomSupplier getRandomSupplier()
-
getDecorators
SeedDecorator[] getDecorators()
-
clone
Randomness clone(java.lang.Thread newOwner)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
destroy
void destroy()
Invalidate the underling randomness.
-
getSeed
long getSeed()
Starting seed, read-only for tests.
-
decorate
private static long decorate(long seed, SeedDecorator[] decorators)
Decorate a given seed.
-
-