/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:31:44 */ /*FOR_C Options SET: ftn=u io=c no=p op=aimnv s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include "ranpk1.h" #include /* COMMON translations */ struct t_rancd1 { long int dptr; LOGICAL32 dgflag; } rancd1; struct t_rancs1 { long int sptr; LOGICAL32 sgflag; } rancs1; /* end of COMMON translations */ void /*FUNCTION*/ ran1() { /* Copyright (c) 1996 California Institute of Technology, Pasadena, CA. * ALL RIGHTS RESERVED. * Based on Government Sponsored Research NAS7-03001. * Program unit: RANPK1 *>> 1995-11-21 RAMPK1 Krogh Removed multiple entries. *>> 1994-06-24 CLL Reorganized common. Using RANC[D/S]1 & RANC[D/S]2. *>> 1992-03-13 CLL Fixed error in RAN0 *>> 1991-11-26 CLL Reorganized common. Using RANCM[A/D/S]. *>> 1991-11-22 CLL Added Entry RAN0 and common variables SGFLAG,DGFLAG *>> 1991-01-15 CLL Reordered common contents for efficiency. *>> 1990-01-23 CLL Corrected type stmt for SNUMS in common. *>> 1987-04-22 RANPK1 Lawson Initial code. * * This program unit, RANPK1, along with RANPK2, * supports random number generation. * * This prog unit has entries RAN1, RAN0, and RANPUT. * The library user can call RAN1 to initialize random number * generation at a standard initial seed, * or call RANPUT(KSEED) to initialize random number generation * at a seed value provided by the integer array, KSEED(). * * Other higher level random number subrs call RAN0 on their first * time flags to be sure the package is initialized. * * As a result of any of these entries this subroutine will * set the pointers in the COMMON arrays to 1, indicating to higher * level random number subprograms that these buffer arrays are * empty. It also sets SGFLAG and DGFLAG to .false. to indicate to * Gaussian generators that they have no internal saved value. * * The user can determine the appropriate dimension for the array, * KSEED() by first calling the entry RANSIZ in prog unit RANPK2. * * The user can retrieve the current seed value by calling entry, * RANGET in prog unit RANPK2. This will be the seed that will be * used the next time a batch of random numbers are computed. This * is not necessarily the seed associated with the next number that * will be returned. * C. L. Lawson, F. T. Krogh, & S. Y. Chiu, JPL, Apr 1987. * ------------------------------------------------------------------ * */ /* ------------------------------------------------------------------ * For use by library users: CALL RAN1 */ rn1(); rancd1.dptr = 1; rancs1.sptr = 1; rancd1.dgflag = FALSE; rancs1.sgflag = FALSE; return; } /* end of function */ /* ------------------------------------------------------------------ * For use by other library subprograms: CALL RAN0 */ void /*FUNCTION*/ ran0() { static LOGICAL32 first = TRUE; if (first) { first = FALSE; rancd1.dptr = 1; rancs1.sptr = 1; rancd1.dgflag = FALSE; rancs1.sgflag = FALSE; } return; } /* end of function */ /* ------------------------------------------------------------------ * For use by library users: CALL RANPUT(KSEED) */ void /*FUNCTION*/ ranput( long kseed[]) { /* OFFSET Vectors w/subscript range: 1 to dimension */ long *const Kseed = &kseed[0] - 1; /* end of OFFSET VECTORS */ rnput( kseed ); rancd1.dptr = 1; rancs1.sptr = 1; rancd1.dgflag = FALSE; rancs1.sgflag = FALSE; return; } /* end of function */