Package org.apache.hadoop.hbase.util
Class Random64
java.lang.Object
org.apache.hadoop.hbase.util.Random64
An instance of this class is used to generate a stream of pseudorandom numbers. The class uses a
64-bit seed, which is modified using a linear congruential formula. see
https://en.wikipedia.org/wiki/Linear_congruential_generator
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final long
private static final long
private long
private static final AtomicLong
-
Constructor Summary
-
Method Summary
-
Field Details
-
multiplier
- See Also:
-
addend
- See Also:
-
seedUniquifier
-
seed
-
-
Constructor Details
-
Random64
public Random64() -
Random64
-
-
Method Details
-
seedUniquifier
Copy fromRandom#seedUniquifier()
-
nextLong
-
nextBytes
-
next64
-
main
Random64 is a pseudorandom algorithm(LCG). Therefore, we will get same sequence if seeds are the same. This main will test how many calls nextLong() it will get the same seed. We do not need to save all numbers (that is too large). We could save once every 100000 calls nextLong(). If it get a same seed, we can detect this by calling nextLong() 100000 times continuously.
-