Trailing-Edge
-
PDP-10 Archives
-
decus_20tap1_198111
-
decus/20-0025/drand.for
There is 1 other file named drand.for in the archive. Click here to see a list.
C PROGRAM DRAND
C AREA BY MONTE CARLO
1000 FORMAT(/' GIVE XLOW,XHIGH, YLOW,YHIGH,STARTING #, # SAMPLES'/5X,$)
1010 FORMAT(4F,2I)
1040 FORMAT(/' SAMPLE',I3,F10.6,5H AREA,
1F10.0,6H UNDER,F10.0,5H OVER/
2F23.9,' X'/F23.9, ' Y')
1 TYPE 1000
ACCEPT 1010,XL,XH,YL,YH,K,NSAMP
XFACT=XH-XL
YFACT=YH-YL
IF(XFACT*YFACT) 2,2,3
2 CALL EXIT
3 OVER=0.
UNDER=0.
DO 40 N=1,NSAMP
DO 30 I=1,100
X=XFACT*RAND(K)
Y=YFACT*RAND(K)
YC=TEST(X)
IF(YC-Y)10,10,20
10 OVER=OVER+1
GO TO 30
20 UNDER=UNDER+1
30 CONTINUE
AREA=(XFACT*YFACT)*(UNDER/(UNDER+OVER))
40 TYPE 1040,N,AREA,UNDER,OVER,X,Y
GO TO 1
END
FUNCTION TEST(XX)
TEST=SIN(XX)
RETURN
END