* G05KJF Example Program Text * Mark 22 Release. NAG Copyright 2006. * .. Parameters .. INTEGER NOUT PARAMETER (NOUT=6) INTEGER MSTATE, MSEED, N, NV PARAMETER (MSTATE=633,MSEED=1,N=50,NV=5) * .. Local Scalars .. INTEGER GENID, I, IFAIL, LSEED, LSTATE, SUBID * .. Local Arrays .. DOUBLE PRECISION X(NV) INTEGER SEED(MSEED), STATE(MSTATE) * .. External Subroutines .. EXTERNAL G05KFF, G05KJF, G05SAF * .. Executable Statements .. WRITE (NOUT,*) 'G05KJF Example Program Results' WRITE (NOUT,*) * Initialize the seed SEED(1) = 1762543 * GENID and SUBID identify the base generator GENID = 1 SUBID = 1 LSTATE = MSTATE LSEED = MSEED * Initialize the generator to a repeatable sequence IFAIL = 1 CALL G05KFF(GENID,SUBID,SEED,LSEED,STATE,LSTATE,IFAIL) IF (IFAIL.NE.0) THEN WRITE (NOUT,99998) IFAIL GO TO 20 END IF * Advance the sequence N places IFAIL = 1 CALL G05KJF(N,STATE,IFAIL) IF (IFAIL.NE.0) THEN WRITE (NOUT,99997) IFAIL GO TO 20 END IF * Generate a NV variates from a uniform distribution IFAIL = 1 CALL G05SAF(NV,STATE,X,IFAIL) IF (IFAIL.NE.0) THEN WRITE (NOUT,99996) IFAIL GO TO 20 END IF * Display the variates WRITE (NOUT,99999) (X(I),I=1,NV) * 20 CONTINUE * 99999 FORMAT (1X,F10.4) 99998 FORMAT (1X,' ** G05KFF returned with IFAIL = ',I5) 99997 FORMAT (1X,' ** G05KJF returned with IFAIL = ',I5) 99996 FORMAT (1X,' ** G05SAF returned with IFAIL = ',I5) END