Package io.github.pr0methean.betterrandom.prng.adapter
Implementations of
BaseRandom
that are backed by
instances of SplittableRandom
or Random
, many of them wrapped
in ThreadLocal
<?>
to allow concurrent use of a shared instance by
multiple threads. The latter is not in general reproducible, since threads start in a
nondeterministic order and do not have a serializable identity.
BaseRandom.setSeed(byte[])
may affect only the
calling thread.-
Class Summary Class Description BaseSplittableRandomAdapter Abstract class for implementations ofBaseRandom
that wrap one or moreSplittableRandom
instances.DirectSplittableRandomAdapter Abstract subclass ofBaseSplittableRandomAdapter
whereDirectSplittableRandomAdapter.setSeed(long)
andBaseRandom.setSeed(byte[])
replace theSplittableRandom
that's used in the context in which they are called.EntropyBlockingRandomWrapper ARandomWrapper
with the additional property that it won't return any output that would take its entropy below a minimum amount, and will instead either wait to be reseeded by aSimpleRandomSeeder
or, if none is installed, reseed itself on the calling thread with aSeedGenerator
.EntropyBlockingSplittableRandomAdapter ASplittableRandomAdapter
that blocks waiting to be reseeded if its entropy drops too low.RandomWrapper ReseedingThreadLocalRandomWrapper AThreadLocalRandomWrapper
that reseeds all its instances using aSimpleRandomSeeder
.SingleThreadSplittableRandomAdapter Simple, non-thread-safe implementation ofBaseRandom
that wraps aSplittableRandom
.SplittableRandomAdapter Thread-safe PRNG that wraps aThreadLocal
<SplittableRandom
>.ThreadLocalRandomWrapper Wraps aThreadLocal
<BaseRandom
> in order to provide concurrency that most implementations ofBaseRandom
can't implement naturally.