public int generate(byte[] output,byte[] additionalInput,boolean predictionResistant){
  int numberOfBits=output.length * 8;
  if (numberOfBits > MAX_BITS_REQUEST) {
    throw new IllegalArgumentException("Number of bits per request limited to " + MAX_BITS_REQUEST);
  }
  if (_reseedCounter > RESEED_MAX) {
    return -1;
  }
  if (predictionResistant) {
    reseed(additionalInput);
    additionalInput=null;
  }
  if (additionalInput != null) {
    hmac_DRBG_Update(additionalInput);
  }
  byte[] rv=new byte[output.length];
  int m=output.length / _V.length;
  _hMac.init(new KeyParameter(_K));
  for (int i=0; i < m; i++) {
    _hMac.update(_V,0,_V.length);
    _hMac.doFinal(_V,0);
    System.arraycopy(_V,0,rv,i * _V.length,_V.length);
  }
  if (m * _V.length < rv.length) {
    _hMac.update(_V,0,_V.length);
    _hMac.doFinal(_V,0);
    System.arraycopy(_V,0,rv,m * _V.length,rv.length - (m * _V.length));
  }
  hmac_DRBG_Update(additionalInput);
  _reseedCounter++;
  System.arraycopy(rv,0,output,0,output.length);
  return numberOfBits;
}

public int generate ( byte [ ] output , byte [ ] additionalInput , boolean predictionResistant ) { int numberOfBits = output . length * 8 ; if ( numberOfBits > MAX_BITS_REQUEST ) { throw new IllegalArgumentException ( "Number of bits per request limited to " + MAX_BITS_REQUEST ) ; } if ( _reseedCounter > RESEED_MAX ) { return - 1 ; } if ( predictionResistant ) { reseed ( additionalInput ) ; additionalInput = null ; } if ( additionalInput != null ) { hmac_DRBG_Update ( additionalInput ) ; } byte [ ] rv = new byte [ output . length ] ; int m = output . length / _V . length ; _hMac . init ( new KeyParameter ( _K ) ) ; for ( int i = 0 ; i < m ; i ++ ) { _hMac . update ( _V , 0 , _V . length ) ; _hMac . doFinal ( _V , 0 ) ; System . arraycopy ( _V , 0 , rv , i * _V . length , _V . length ) ; } if ( m * _V . length < rv . length ) { _hMac . update ( _V , 0 , _V . length ) ; _hMac . doFinal ( _V , 0 ) ; System . arraycopy ( _V , 0 , rv , m * _V . length , rv . length - ( m * _V . length ) ) ; } hmac_DRBG_Update ( additionalInput ) ; _reseedCounter ++ ; System . arraycopy ( rv , 0 , output , 0 , output . length ) ; return numberOfBits ; }
populate a passed in array with random data .
