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) {
    byte[] newInput=new byte[1 + _V.length + additionalInput.length];
    newInput[0]=0x02;
    System.arraycopy(_V,0,newInput,1,_V.length);
    System.arraycopy(additionalInput,0,newInput,1 + _V.length,additionalInput.length);
    byte[] w=hash(newInput);
    addTo(_V,w);
  }
  byte[] rv=hashgen(_V,numberOfBits);
  byte[] subH=new byte[_V.length + 1];
  System.arraycopy(_V,0,subH,1,_V.length);
  subH[0]=0x03;
  byte[] H=hash(subH);
  addTo(_V,H);
  addTo(_V,_C);
  byte[] c=new byte[4];
  c[0]=(byte)(_reseedCounter >> 24);
  c[1]=(byte)(_reseedCounter >> 16);
  c[2]=(byte)(_reseedCounter >> 8);
  c[3]=(byte)_reseedCounter;
  addTo(_V,c);
  _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 ) { byte [ ] newInput = new byte [ 1 + _V . length + additionalInput . length ] ; newInput [ 0 ] = 0x02 ; System . arraycopy ( _V , 0 , newInput , 1 , _V . length ) ; System . arraycopy ( additionalInput , 0 , newInput , 1 + _V . length , additionalInput . length ) ; byte [ ] w = hash ( newInput ) ; addTo ( _V , w ) ; } byte [ ] rv = hashgen ( _V , numberOfBits ) ; byte [ ] subH = new byte [ _V . length + 1 ] ; System . arraycopy ( _V , 0 , subH , 1 , _V . length ) ; subH [ 0 ] = 0x03 ; byte [ ] H = hash ( subH ) ; addTo ( _V , H ) ; addTo ( _V , _C ) ; byte [ ] c = new byte [ 4 ] ; c [ 0 ] = ( byte ) ( _reseedCounter > > 24 ) ; c [ 1 ] = ( byte ) ( _reseedCounter > > 16 ) ; c [ 2 ] = ( byte ) ( _reseedCounter > > 8 ) ; c [ 3 ] = ( byte ) _reseedCounter ; addTo ( _V , c ) ; _reseedCounter ++ ; System . arraycopy ( rv , 0 , output , 0 , output . length ) ; return numberOfBits ; }
populate a passed in array with random data .
