final byte v = (byte) rng.nextInt();
b.write(v);
expect[written++] = v;
} else {
final int len = Math
.min(rng.nextInt() & 127, max - written);
final byte[] tmp = rng.nextBytes(len);
b.write(tmp, 0, len);
System.arraycopy(tmp, 0, expect, written, len);
written += len;
}