Interface EntropyCountingRandom
-
- All Known Implementing Classes:
AesCounterRandom
,BaseRandom
,BaseSplittableRandomAdapter
,CipherCounterRandom
,Cmwc4096Random
,DirectSplittableRandomAdapter
,EntropyBlockingRandomWrapper
,EntropyBlockingSplittableRandomAdapter
,MersenneTwisterRandom
,Pcg128Random
,Pcg64Random
,RandomWrapper
,ReseedingThreadLocalRandomWrapper
,SingleThreadSplittableRandomAdapter
,SplittableRandomAdapter
,ThreadLocalRandomWrapper
,XorShiftRandom
public interface EntropyCountingRandom
ARandom
that can track its inflow and outflow of entropy so we can determine when it needs reseeding again.- Author:
- Chris Hennick
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
getEntropyBits()
Returns an estimate of the current amount of entropy.boolean
needsReseedingEarly()
If true, this PRNG needs reseeding even though its entropy is positive.
-
-
-
Method Detail
-
getEntropyBits
long getEntropyBits()
Returns an estimate of the current amount of entropy. Every time the PRNG is reseeded, the entropy count is set to the new seed's length; and every time it is used, it is decreased by the number of random bits in the output rounded up. The amount of entropy can go below zero, giving an indication of how far the entropy has been stretched. This estimate is a lower bound if the seed is perfectly random and is not being reused.- Returns:
- The current estimated amount of entropy.
-
needsReseedingEarly
boolean needsReseedingEarly()
If true, this PRNG needs reseeding even though its entropy is positive. Added to deal withEntropyBlockingRandomWrapper
.- Returns:
- true if this PRNG needs reseeding regardless of entropy count; false otherwise
-
-