public static void main(String[] args) {
    long defaultTotalTestCnt = 1000000000000L; // 1 trillion

    if (args.length == 1) {
      defaultTotalTestCnt = Long.parseLong(args[0]);
    }

    Preconditions.checkArgument(defaultTotalTestCnt > 0, "totalTestCnt <= 0");

    final int precision = 100000;
    final long totalTestCnt = defaultTotalTestCnt + precision;
    final int reportPeriod = 100 * precision;
    final long startTime = EnvironmentEdgeManager.currentTime();

    System.out.println("Do collision test, totalTestCnt=" + totalTestCnt);

    Random64 rand = new Random64();
    Set<Long> longSet = new HashSet<>();

    for (long cnt = 1; cnt <= totalTestCnt; cnt++) {
      final long randLong = rand.nextLong();

      if (longSet.contains(randLong)) {
        System.err.println("Conflict! count=" + cnt);
        System.exit(1);
      }

      if (cnt % precision == 0) {
        if (!longSet.add(randLong)) {
          System.err.println("Conflict! count=" + cnt);
          System.exit(1);
        }

        if (cnt % reportPeriod == 0) {
          long cost = EnvironmentEdgeManager.currentTime() - startTime;
          long remainingMs = (long) (1.0 * (totalTestCnt - cnt) * cost / cnt);
          System.out.println(String.format("Progress: %.3f%%, remaining %d minutes",
            100.0 * cnt / totalTestCnt, remainingMs / 60000));
        }
      }

    }

    System.out.println("No collision!");
  }
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.
hbase-common/src/main/java/org/apache/hadoop/hbase/util/Random64.java