/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:31:56 */ /*FOR_C Options SET: ftn=u io=c no=p op=aimnv s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include "dranu.h" #include /* PARAMETER translations */ #define M 97 /* end of PARAMETER translations */ /* COMMON translations */ struct t_rancd2 { double dnums[M]; } rancd2; struct t_rancd1 { long int dptr; LOGICAL32 dgflag; } rancd1; /* end of COMMON translations */ double /*FUNCTION*/ dranu() { double dranu_v; static LOGICAL32 first = TRUE; /* OFFSET Vectors w/subscript range: 1 to dimension */ double *const Dnums = &rancd2.dnums[0] - 1; /* end of OFFSET VECTORS */ /* Copyright (c) 1996 California Institute of Technology, Pasadena, CA. * ALL RIGHTS RESERVED. * Based on Government Sponsored Research NAS7-03001. *>> 1994-10-20 DRANU Krogh Changes to use M77CON *>> 1994-06-24 DRANU CLL Changed common to use RANC[D/S]1 & RANC[D/S]2. *>> 1992-03-16 CLL *>> 1991-11-26 CLL Reorganized common. Using RANCM[A/D/S]. *>> 1991-11-22 CLL Added call to RAN0, and DGFLAG in common. *>> 1991-01-15 CLL Reordered common contents for efficiency. *>> 1990-01-23 CLL Making names in common same in all subprogams. *>> 1987-04-22 DRANU Lawson Initial code. * Returns one pseudorandom number from the uniform distribution * on [0., 1.]. * C. L. Lawson & S. Y. Chiu, JPL, Apr 1987. * ------------------------------------------------------------------ *--D replaces "?": ?RANU, ?RANUA, RANC?1, RANC?2, ?PTR, ?NUMS, ?GFLAG * RANCD1 and RANCD2 are common blocks. * Calls RAN0 to initialize DPTR and DGFLAG. * ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */ if (first) { first = FALSE; ran0(); } rancd1.dptr -= 1; if (rancd1.dptr == 0) { dranua( rancd2.dnums, M ); rancd1.dptr = M; } dranu_v = Dnums[rancd1.dptr]; return( dranu_v ); } /* end of function */