s******g 发帖数: 30 | 1 下面是一段写于1970年的fortran程序.
C
C RANF(0) RETURNS A RANDOM NUMBER UNIFORMLY DISTRIBUTED BETWEEN
C ZERO AND ONE AT EACH CALL
C R(I) HAS A GAUSSIAN DISTRIBUTION
C
DO 40 I=1,N
39 XY=-ALOG(RANF(0))
YY=-ALOG(RANF(0))
IF(YY.LT.0.5*(XY-1.0)**2)GO TO 39
40 R(I)=SIGN(XY,RANF(0)-.5)
没搞明摆这样获得的R(I)随机数具有高司分布.
主要是IF后的条件.
哪位指点一下.呵呵.. |
|