// Test Binomialdev
System.out.println("Testing Binomialdev");
// Check fingerprint of doub()
pp=0.5;
Binomialdev myran = new Binomialdev(M,pp,17);
localflag=false;
for (i=0;i<10;i++)
// System.out.printf(setw(25) << setprecision(20) << myran.dev());
localflag=localflag || (myran.dev() != fingerprint[i]);
globalflag = globalflag || localflag;
if (localflag) {
fail("*** Binomialdev: dev() does not match fingerprint");
}
// Check statistics
Binomialdist expect = new Binomialdist(M,pp);
for (i=0;i<M;i++) {
ebins[i]=(N)*expect.p(i);
bins[i]=0;
}
for (i=0;i<N;i++) {
nbin=myran.dev();
if ((nbin >= 0) && (nbin < M)) bins[nbin] += 1;
}
chsone(bins,ebins,df,chisq,prob);
System.out.printf(" chisq,dev(): %f\n prob: %f\n",chisq.val, prob.val);
localflag = (prob.val < 0.05);