Environmental Engineering Reference
In-Depth Information
End Do
Do I = 1,521
Z2(I) = Z2(I + 1000)
End Do
***************************************************************
Set the random number counter to RanSize so that a proper checking
code will force a call to GenRan in the main program.
***************************************************************
RanCnt = RanSize
RETURN
END
SUBROUTINE GenRan
***************************************************************
Generate vector RanVec (length RanSize) of pseudorandom 31-bit
integers.
***************************************************************
IMPLICIT non-E
INTEGER RanSize,RanCnt,I
PARAMETER(RanSize = 100000)
INTEGER RanVec(RanSize),Z1(250+RanSize),Z2(521+RanSize)
COMMON/MyRan/RanVec,Z1,Z2,RanCnt
SAVE
***************************************************************
Generate RanSize pseudorandom numbers using the individual generators
***************************************************************
Do I = 1,RanSize
Z1(I+250) = IEOR(Z1(I),Z1(I+147))
Z2(I+521) = IEOR(Z2(I),Z2(I+353))
End Do
***************************************************************
Combine the R250 and R521 numbers and put the result into RanVec
***************************************************************
Do I = 1,RanSize
RanVec(I) = IEOR(Z1(I+250),Z2(I+521))
End Do
***************************************************************
Copy the last 250 numbers generated by R250 and the last 521 numbers
from R521 into the working vectors (Z1), (Z2) for the next pass.
***************************************************************
Do I = 1,250
Z1(I) = Z1(I + RanSize)
Search WWH ::




Custom Search