Package com.nr.ran

Examples of com.nr.ran.Ranfib


    average=N/(double)(M);
    double[] ebins = buildVector(M,average);

    // Check fingerprint of int32()
    localflag=false;
    Ranfib myran1 = new Ranfib(171);
    for (i=0;i<10;i++) {
      localflag=(myran1.int32() != fingerprint1[i]) || localflag;
    }
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Ranfib: int32() does not match fingerprint");
     
    }

    // Check statistics
    for (i=0;i<M;i++) bins[i]=0;
    for (i=0;i<N;i++) bins[myran1.int32p()%M] += 1;
    chsone(bins,ebins,dfW,chisqW,probW);df = dfW.val; chisq = chisqW.val; prob = probW.val;
    System.out.printf("     chisq,int32(): %f  prob: %f\n",chisq, prob);
    localflag = (prob < 0.05);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Ranfib: int32() does not give distribution with correct variance");
     
    }

    // Check fingerprint of doub()
    Ranfib myran2 = new Ranfib(17);
    localflag=false;
    for (i=0;i<10;i++)
      localflag=localflag || abs(myran2.doub()-fingerprint2[i])>sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Ranfib: doub() does not match fingerprint");
     
    }

    // Check statistics
    for (i=0;i<M;i++) bins[i]=0;
    for (i=0;i<N;i++) bins[(int)(floor(M*myran2.doub()))] += 1;
    chsone(bins,ebins,dfW,chisqW,probW);df = dfW.val; chisq = chisqW.val; prob = probW.val;
    System.out.printf("     chisq,doub(): %f  prob: %f\n",chisq, prob);
    localflag = (prob < 0.05);
    globalflag = globalflag || localflag;
    if (localflag) {
View Full Code Here

TOP

Related Classes of com.nr.ran.Ranfib

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.