@Test
public void testNextBytesManyBytes() {

  Random rand = new Random(42);
  final byte[] seed1 = new byte[32];
  rand.nextBytes(seed1);
  rand.nextBytes(seed1);
  AesCtrDrbg drbg1 = new AesCtrDrbg(seed1);
  AesCtrDrbg drbg2 = new AesCtrDrbg(seed1);
  // Setting the array size to ~1 million should force state updates
  final int arraySize = (1 << 20);
  byte[] bytes1 = new byte[arraySize];
  byte[] bytes2 = new byte[arraySize];
  drbg1.nextBytes(bytes1);
  drbg2.nextBytes(bytes2);
  // Bytes should be equal
  assertArrayEquals(bytes1, bytes2);
  // The zero-array is very unlikely
  assertFalse(Arrays.equals(bytes1, new byte[arraySize]));
}