  /** Compares the averages of samples s1 and s2 
      using trialsN (e.g. 10000) resampling trials
      and returns the set of that many differences
      mean(resample(s1)) - mean(resample(s2))
      You can paint a histogram of the result 
      or read quantiles from it etc.
  */
  static ResampleVector cmpmean(ResampleVector s1, ResampleVector s2, 
                                int trialsN) {
     ResampleVector r1, r2;
     ResampleVector result = new ResampleVector(trialsN);
     for (int i = 1; i <= trialsN; i++) {
        r1 = s1.sample(s1.size()); // resample from s1
        r2 = s2.sample(s2.size()); // resample from s2
        result.addElement(r1.mean() - r2.mean()); // compare the resamples
     }
     result.sort();
     return result;
  }
