Category : Miscellaneous Language Source Code
Archive   : FORTRN77.ZIP
Filename : PORNG.FOR

 
Output of file : PORNG.FOR contained in archive : FORTRN77.ZIP
SUBROUTINE PORNG(L,MAX,IFLAG,R,Y,S,X)
C
C THIS SUBROUTINE GENERATES A SEQUENCE OF RANDOM NUMBERS FROM
C UNIFORMLY DISTRIBUTED RANDOM NUMBERS BY THE METHOD OF LINEAR
C APPROXIMATION OF THE INVERSE OF THE ACCUMULATIVE POISSON
C DISTRIBUTION FUNCTION.
C
DIMENSION Y(1), S(1)
IF (IFLAG.EQ.0) GO TO 3
E = .367879
IFLAG = 0
Y(1) = 0.0
Z = E**L
N = MAX - 1
Y(MAX + 1) = 1.0
XL = L
DO 1 I = 1,N
Y(I + 1) = Y(I) + Z
S(I) = Y(I + 1) - Y(I)
1 Z = Z*XL/FLOAT(I)
S(MAX) = 1.0 - Y(MAX)
3 CALL STRNUM(R)
DO 4 I = 1,MAX
IF (R.LE.Y(I + 1)) GO TO 5
4 CONTINUE
5 X = (R - Y(I))/S(I) + FLOAT(I)
RETURN
END


  3 Responses to “Category : Miscellaneous Language Source Code
Archive   : FORTRN77.ZIP
Filename : PORNG.FOR

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/