// Test chstwo
System.out.println("Testing chstwo");
Expondev edev = new Expondev(1.0,17);
for (i=0;i<NPTS;i++) {
x=edev.dev();
ibin=(int)(x*NBINS/3.0);
if (ibin < NBINS) ++bins1[ibin];
}
for (i=0;i<NBINS;i++) bins2[i]=bins1[i];
chstwo(bins1,bins2,df,chsq,prob,0);
localflag = localflag || (chsq.val != 0.) || (prob.val != 1);
globalflag = globalflag || localflag;
if (localflag) {
fail("*** chtwo: Incorrect chsq or prob for perfectly matching distributions");
}
for (i=0;i<NBINS;i++) bins2[i]=0;
for (i=0;i<NPTS;i++) {
x=edev.dev();
ibin=(int)(x*NBINS/3.0);
if (ibin < NBINS) ++bins2[ibin];
}
chstwo(bins1,bins2,df,chsq,prob,0);
// System.out.printf(df << " %f\n", chsq << " %f\n", prob);