class DrngImpl implements Drng {

  @Override
  public long nextLong(long limit) {
    if (limit < 1) {
      throw new IllegalArgumentException("Limit must be strictly positive, but is: " + limit);
    }
    int bitSize = (Long.SIZE - Long.numberOfLeadingZeros(limit - 1));
    byte[] bytes = getBytes(bitSize);
    long result = Byte.toUnsignedLong(bytes[0]);
    for (int i = 1; i < bytes.length; i++) {
      result <<= 8;
      result ^= Byte.toUnsignedLong(bytes[i]);
    }
    return result < limit ? result : nextLong(limit);
  }

  public  DrngImpl(Drbg drbg);

}