/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:33:18 */ /*FOR_C Options SET: ftn=u io=c no=p op=aimnv pf=,p_sranu s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include #include #include "p_sranu.h" /* program DRSRANU *>> 1996-05-28 DRSRANU Krogh Added external statement. *>> 1994-10-19 DRSRANU Krogh Changes to use M77CON *>> 1992-03-13 DRSRANU CLL *>> 1987-12-09 DRSRANU Lawson Initial Code. * * Driver to demonstrate use of SRANU to generate random numbers * from the uniform distribution on [0.0, 1.0]. * Program computes histogram for N numbers * ------------------------------------------------------------------ *--S replaces "?": DR?RANU, ?RANU, ?STAT1, ?STAT2 * ------------------------------------------------------------------ */ /* PARAMETER translations */ #define N 10000 #define NCELLS (10 + 2) /* end of PARAMETER translations */ int main( ) { long int i, ihist[NCELLS]; float stats[5], ytab[1]; static float y1 = 0.0e0; static float y2 = 1.0e0; /* OFFSET Vectors w/subscript range: 1 to dimension */ long *const Ihist = &ihist[0] - 1; float *const Stats = &stats[0] - 1; float *const Ytab = &ytab[0] - 1; /* end of OFFSET VECTORS */ /* ------------------------------------------------------------------ */ Stats[1] = 0.0e0; for (i = 1; i <= N; i++) { /* Get random number */ Ytab[1] = sranu(); /* Accumulate statistics and histogram. * */ sstat1( &Ytab[1], 1, stats, ihist, NCELLS, y1, y2 ); } /* Print the statistics and histogram. * */ printf(" Uniform random numbers from SRANU\n\n\n"); sstat2( stats, ihist, NCELLS, y1, y2 ); exit(0); } /* end of function */