This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: c ia=8*idint(halfm*datan(1.d0)/8.D0)+5 ic=2*idint(halfm*(0.5d0-dsqrt(3.d0)/6.d0))+1 mic=(m2-ic) c c s is the scale factor for converting to floating point c s=0.5/halfm c c compute next random number c 20 iy=iy*ia c c the following statement is for computers which do not allow c integer overflow on addition c if(iy.gt.mic)iy=(iy-m2)-m2 c iy=iy+ic c c the following statement is for computers where the word length c for addition is greater than for multiplication c if(iy/2.gt.m2)iy=(iy-m2)-m2 c c the following statement is for computers where integer overflow c affects the sign bit c if(iy.lt.0)iy=(iy+m2)+m2 c urand=float(iy)*s return end...
View Full Document
- Spring '08