private long getNextRow(long index, long chainLength) {
      long nextRow = ThreadLocalRandom.current().nextLong(Long.MAX_VALUE);
      // use significant bits from the random number, but pad with index to ensure it is unique
      // this also ensures that we do not reuse row = 0
      // row collisions from multiple mappers are fine, since we guarantee unique chainIds
      nextRow = nextRow - (nextRow % chainLength) + index;
      return nextRow;
    }
Returns a unique row id within this chain for this index
hbase-it/src/test/java/org/apache/hadoop/hbase/mapreduce/IntegrationTestBulkLoad.java