/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:33:14 */ /*FOR_C Options SET: ftn=u io=c no=p op=aimnv pf=,p_isranp s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include #include #include "p_isranp.h" /* program DRISRANP *>> 1996-07-09 DRISRANP Krogh Added external statement. *>> 1994-10-19 DRISRANP Krogh Changes to use M77CON *>> 1994-06-23 DRISRANP Changing name to DRI[D/S]RANP. *>> 1987-12-09 DRISRANP Lawson Initial Code. * * Driver to demonstrate use of ISRANP to generate random integers * from the Poisson distribution with mean, XMEAN. * Program computes histogram for N samples. * ------------------------------------------------------------------ *--S replaces "?": DRI?RANP, I?RANP, I?STA1, I?STA2 * ------------------------------------------------------------------ */ /* PARAMETER translations */ #define NCELLS (7 + 2) #define NI 100 /* end of PARAMETER translations */ int main( ) { long int i, ihist[NCELLS], istats[3], itab[NI], j; float xstats[2]; static long n = 10000; static long ilow = 0; static float xmean = 1.0e0; /* OFFSET Vectors w/subscript range: 1 to dimension */ long *const Ihist = &ihist[0] - 1; long *const Istats = &istats[0] - 1; long *const Itab = &itab[0] - 1; float *const Xstats = &xstats[0] - 1; /* end of OFFSET VECTORS */ /* ------------------------------------------------------------------ */ Istats[1] = 0; for (j = 1; j <= (n/NI); j++) { for (i = 1; i <= NI; i++) { /* Get random integer. */ Itab[i] = isranp( xmean ); } /* Accumulate statistics and histogram. * */ issta1( itab, NI, istats, xstats, ihist, ilow, NCELLS ); } /* Print the statistics and histogram. * */ printf(" Poisson random integers from ISRANP\n"); printf(" with XMEAN = %12.4g\n \n", xmean); issta2( istats, xstats, ihist, ilow, NCELLS ); exit(0); } /* end of function */