public void test_huffmanRecoderStress() throws IOException {
  final int ntrials=10000;
  final int percentZero=40;
  final Random r=new Random();
  for (int trial=0; trial < ntrials; trial++) {
    final int[] frequency=new int[256];
    for (int i=0; i < frequency.length; i++) {
      if (r.nextInt() < percentZero) {
        frequency[i]=0;
      }
 else {
        frequency[i]=r.nextInt(4000);
      }
    }
    doRecoderRoundTripTest(frequency);
  }
}

public void test_huffmanRecoderStress ( ) throws IOException { final int ntrials = 10000 ; final int percentZero = 40 ; final Random r = new Random ( ) ; for ( int trial = 0 ; trial < ntrials ; trial ++ ) { final int [ ] frequency = new int [ 256 ] ; for ( int i = 0 ; i < frequency . length ; i ++ ) { if ( r . nextInt ( ) < percentZero ) { frequency [ i ] = 0 ; } else { frequency [ i ] = r . nextInt ( 4000 ) ; } } doRecoderRoundTripTest ( frequency ) ; } }
stress test with 256 distinct symbols ( corresponding to byte values in the application ) . a large percentage of all symbols have a zero frequency code , which models the expected patterns of b + tree keys .
