if (!initialised) throw new IllegalStateException("not initialized");  if (length == 0) return;  if (offset < 0 || length < 0 || offset + length > out.length) throw new ArrayIndexOutOfBoundsException("offset=" + offset + " length=" + length + " limit=" + out.length);  if (ndx >= buffer.length) { fillBlock(); ndx = 0; } int count = 0; while (count < length) { int amount = Math.min(buffer.length - ndx, length - count); System.arraycopy(buffer, ndx, out, offset + count, amount); count += amount; ndx += amount; if (ndx >= buffer.length) { fillBlock(); ndx = 0; } }
nextBytes(out, 0, out.length);
  public void nextBytes(byte[] out, int offset, int length)      throws IllegalStateException, LimitReachedException  {    if (!initialised)      throw new IllegalStateException("not initialized");    if (length == 0)      return;    if (offset < 0 || length < 0 || offset + length > out.length)      throw new ArrayIndexOutOfBoundsException("offset=" + offset + " length="                                               + length + " limit="                                               + out.length);    if (ndx >= buffer.length)      {        fillBlock();        ndx = 0;      }    int count = 0;    while (count < length)      {        int amount = Math.min(buffer.length - ndx, length - count);        System.arraycopy(buffer, ndx, out, offset + count, amount);        count += amount;        ndx += amount;        if (ndx >= buffer.length)          {            fillBlock();            ndx = 0;          }      }  }