int generate(byte[] output,boolean predictionResistant){
  if (R.length == 8) {
    if (reseedCounter > BLOCK64_RESEED_MAX) {
      return -1;
    }
    if (isTooLarge(output,BLOCK64_MAX_BITS_REQUEST / 8)) {
      throw new IllegalArgumentException("Number of bits per request limited to " + BLOCK64_MAX_BITS_REQUEST);
    }
  }
 else {
    if (reseedCounter > BLOCK128_RESEED_MAX) {
      return -1;
    }
    if (isTooLarge(output,BLOCK128_MAX_BITS_REQUEST / 8)) {
      throw new IllegalArgumentException("Number of bits per request limited to " + BLOCK128_MAX_BITS_REQUEST);
    }
  }
  if (predictionResistant || V == null) {
    V=entropySource.getEntropy();
  }
  int m=output.length / R.length;
  for (int i=0; i < m; i++) {
    engine.processBlock(DT,0,I,0);
    process(R,I,V);
    process(V,R,I);
    System.arraycopy(R,0,output,i * R.length,R.length);
    increment(DT);
  }
  int bytesToCopy=(output.length - m * R.length);
  if (bytesToCopy > 0) {
    engine.processBlock(DT,0,I,0);
    process(R,I,V);
    process(V,R,I);
    System.arraycopy(R,0,output,m * R.length,bytesToCopy);
    increment(DT);
  }
  reseedCounter++;
  return output.length;
}

int generate ( byte [ ] output , boolean predictionResistant ) { if ( R . length == 8 ) { if ( reseedCounter > BLOCK64_RESEED_MAX ) { return - 1 ; } if ( isTooLarge ( output , BLOCK64_MAX_BITS_REQUEST / 8 ) ) { throw new IllegalArgumentException ( "Number of bits per request limited to " + BLOCK64_MAX_BITS_REQUEST ) ; } } else { if ( reseedCounter > BLOCK128_RESEED_MAX ) { return - 1 ; } if ( isTooLarge ( output , BLOCK128_MAX_BITS_REQUEST / 8 ) ) { throw new IllegalArgumentException ( "Number of bits per request limited to " + BLOCK128_MAX_BITS_REQUEST ) ; } } if ( predictionResistant || V == null ) { V = entropySource . getEntropy ( ) ; } int m = output . length / R . length ; for ( int i = 0 ; i < m ; i ++ ) { engine . processBlock ( DT , 0 , I , 0 ) ; process ( R , I , V ) ; process ( V , R , I ) ; System . arraycopy ( R , 0 , output , i * R . length , R . length ) ; increment ( DT ) ; } int bytesToCopy = ( output . length - m * R . length ) ; if ( bytesToCopy > 0 ) { engine . processBlock ( DT , 0 , I , 0 ) ; process ( R , I , V ) ; process ( V , R , I ) ; System . arraycopy ( R , 0 , output , m * R . length , bytesToCopy ) ; increment ( DT ) ; } reseedCounter ++ ; return output . length ; }
populate a passed in array with random data .
