DrngImpl implements Drng { @Override public int nextInt(int limit) { return (int)nextLong(limit); } DrngImpl(Drbg drbg); @Override int nextInt(int limit); @Override long nextLong(long limit); @Override BigInteger nextBigInteger(BigInteger limit); @Override boolean nextBit();  }
@Test public void testNextInt() { int limit = 1000; for (int i = 0; i < 10; i++) { int r = drng.nextInt(limit); assertInRange(r, 0, limit); } }
@Test public void testNextIntByteSize() { int limit = 256; for (int i = 0; i < 10; i++) { int r = drng.nextInt(limit); assertInRange(r, 0, limit); } }
@Test public void testNextIntMaxSize() { int limit = Integer.MAX_VALUE; for (int i = 0; i < 10; i++) { int r = drng.nextInt(limit); assertInRange(r, 0, limit); } }
@Test (expected = IllegalArgumentException.class) public void testNextIntNegativeSize() { int limit = -1; for (int i = 0; i < 10; i++) { int r = drng.nextInt(limit); assertInRange(r, 0, limit); } }
@Test (expected = IllegalArgumentException.class) public void testNextIntZeroSize() { int limit = 0; for (int i = 0; i < 10; i++) { int r = drng.nextInt(limit); assertInRange(r, 0, limit); } }