Class Random64

java.lang.Object
org.apache.hadoop.hbase.util.Random64

@Private public class Random64 extends Object
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 Details

  • Constructor Details

  • Method Details

    • seedUniquifier

      private static long seedUniquifier()
      Copy from Random#seedUniquifier()
    • nextLong

      public long nextLong()
    • nextBytes

      public void nextBytes(byte[] bytes)
    • next64

      private long next64(int bits)
    • main

      public static void main(String[] args)
      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.