Environmental Engineering Reference
In-Depth Information
Now fill up the tables for the R250 & R521 generators: This
requires random integers in the range 0±> 2*31 1. Iterate a
strange number of times to improve randomness.
***************************************************************
Do I = 1,250
Z1(I) = 0
IBit = 1
Do J = 0,30
Do K = 1,37
RMod = RMod*16807.0D0
IMod = RMod/PMod
RMod = RMod - PMod*IMod
End Do
Now use this random number to set bit J of X(I).
IF (RMod. GT. 0.5D0*PMod) Z1(I) = IEOR(Z1(I),IBit)
IBit = IBit*2
End Do
End Do
Do I = 1,521
Z2(I) = 0
IBit = 1
Do J = 0,30
Do K = 1,37
RMod = RMod*16807.0D0
IMod = RMod/PMod
RMod = RMod-PMod*IMod
End Do
Now use this random number to set bit J of X(I).
IF (RMod. GT. 0.5D0*PMod) Z2(I) = IEOR(Z2(I),IBit)
IBit = IBit*2
End Do
End Do
***************************************************************
Perform a few iterations of the R250 and R521 random number generators
to eliminate any effects due to'poor' initialization.
***************************************************************
Do I = 1,1000
Z1(I+250) = IEOR(Z1(I),Z1(I+147))
Z2(I+521) = IEOR(Z2(I),Z2(I+353))
End Do
Do I = 1,250
Z1(I) = Z1(I + 1000)
Search WWH ::




Custom Search