C  See help for RANDOMV on the PSFSHARE disk to understand these        RAN00010
C  subroutines.  This is the VS Fortran version of this code.           RAN00020
C                                                                       RAN00030
      SUBROUTINE VRND(VEC,N)                                            RAN00040
      INTEGER A(250)                                                    RAN00050
      COMMON /VRANDD/ A, I, I147                                        RAN00060
      INTEGER LOOP,I,I147,VEC(N)                                        RAN00070
      DO 23000 LOOP=1,N                                                 RAN00080
      I=I+1                                                             RAN00090
      IF(.NOT.(I.GE.251))GOTO 23002                                     RAN00100
      I=1                                                               RAN00110
23002 CONTINUE                                                          RAN00120
      I147=I147+1                                                       RAN00130
      IF(.NOT.(I147.GE.251))GOTO 23004                                  RAN00140
      I147=1                                                            RAN00150
23004 CONTINUE                                                          RAN00160
      A(I)=IEOR(A(I147),A(I))                                           RAN00170
      VEC(LOOP)=A(I)                                                    RAN00180
23000 CONTINUE                                                          RAN00190
      RETURN                                                            RAN00200
      END                                                               RAN00210
C                                                                       RAN00220
C                                                                       RAN00230
      DOUBLE PRECISION FUNCTION RNDV(IDUM)                              RAN00240
      DOUBLE PRECISION RM1,RM2,R(99)                                    RAN00250
      INTEGER IA1,IC1,M1, IA2,IC2,M2, IA3,IC3,M3, IDUM                  RAN00260
      SAVE                                                              RAN00270
      DATA IA1,IC1,M1/1279,351762,1664557/                              RAN00280
      DATA IA2,IC2,M2/2011,221592,1048583/                              RAN00290
      DATA IA3,IC3,M3/15551,6150,29101/                                 RAN00300
      IF(.NOT.(IDUM.LT.0))GOTO 23006                                    RAN00310
      IX1 = MOD(-IDUM,M1)                                               RAN00320
      IX1 = MOD(IA1*IX1+IC1,M1)                                         RAN00330
      IX2 = MOD(IX1,M2)                                                 RAN00340
      IX1 = MOD(IA1*IX1+IC1,M1)                                         RAN00350
      IX3 = MOD(IX1,M3)                                                 RAN00360
      RM1 = 1./DBLE(M1)                                                 RAN00370
      RM2 = 1./DBLE(M2)                                                 RAN00380
      DO 23008 J = 1,99                                                 RAN00390
      IX1 = MOD(IA1*IX1+IC1,M1)                                         RAN00400
      IX2 = MOD(IA2*IX2+IC2,M2)                                         RAN00410
      R(J) = (DBLE(IX1)+DBLE(IX2)*RM2)*RM1                              RAN00420
23008 CONTINUE                                                          RAN00430
23006 CONTINUE                                                          RAN00440
      IX1 = MOD(IA1*IX1+IC1,M1)                                         RAN00450
      IX2 = MOD(IA2*IX2+IC2,M2)                                         RAN00460
      IX3 = MOD(IA3*IX3+IC3,M3)                                         RAN00470
      J = 1+(99*IX3)/M3                                                 RAN00480
      RNDV = R(J)                                                       RAN00490
      R(J) = (DBLE(IX1)+DBLE(IX2)*RM2)*RM1                              RAN00500
      IDUM = IX1                                                        RAN00510
      RETURN                                                            RAN00520
      END                                                               RAN00530
C                                                                       RAN00540
C                                                                       RAN00550
      SUBROUTINE VRNDST(SEED)                                           RAN00560
      INTEGER A(250),LOOP,IDUM,SEED                                     RAN00570
      DOUBLE PRECISION RNDV                                             RAN00580
      COMMON /VRANDD/ A, I, I147                                        RAN00590
      I=0                                                               RAN00600
      I147=103                                                          RAN00610
      IDUM=SEED                                                         RAN00620
      DO 23010 LOOP=1,250                                               RAN00630
      A(LOOP)=INT(RNDV(IDUM)*2147483647)                                RAN00640
23010 CONTINUE                                                          RAN00650
      RETURN                                                            RAN00660
      END                                                               RAN00670
C                                                                       RAN00680
C                                                                       RAN00690
      SUBROUTINE VRNDIN(IODEV)                                          RAN00700
      INTEGER IODEV, A(250)                                             RAN00710
      COMMON/VRANDD/ A, I, I147                                         RAN00720
      READ(IODEV) A, I, I147                                            RAN00730
      RETURN                                                            RAN00740
      END                                                               RAN00750
C                                                                       RAN00760
C                                                                       RAN00770
      SUBROUTINE VRNDOU(IODEV)                                          RAN00780
C       This corresponds to VRNDOUT in the APFTN64 version              RAN00790
      INTEGER IODEV, A(250)                                             RAN00800
      COMMON/VRANDD/ A, I, I147                                         RAN00810
      WRITE(IODEV) A, I, I147                                           RAN00820
      RETURN                                                            RAN00830
      END                                                               RAN00840
