	PROGRAM D8R5
C	Driver for routine INDEXX
	DIMENSION A(100),INDX(100)
	OPEN(5,FILE='TARRAY.DAT',STATUS='OLD')
	READ(5,*) (A(I),I=1,100)
	CLOSE(5)
C	Generate index for sorted array
	CALL INDEXX(100,A,INDX)
C	Print original array
	WRITE(*,*) 'Original array:'
	DO 11 I=1,10
		WRITE(*,'(1X,10F6.2)') (A(10*(I-1)+J),J=1,10)
11	CONTINUE
C	Print sorted array
	WRITE(*,*) 'Sorted array:'
	DO 12 I=1,10
		WRITE(*,'(1X,10F6.2)') (A(INDX(10*(I-1)+J)),J=1,10)
12	CONTINUE
	END
	PROGRAM D7R10
C	Driver for routine IRBIT1
C	Calculate distribution of runs of zeros
	PARAMETER(NBIN=15,NTRIES=10000)
	DIMENSION DELAY(NBIN)
	ISEED=12345
	DO 11 I=1,NBIN			 
		DELAY(I)=0.0
11	CONTINUE
	IPTS=0
	DO 13 I=1,NTRIES
		IF (IRBIT1(ISEED).EQ.1) THEN		
			IPTS=IPTS+1
			IFLG=0
			DO 12 J=1,NBIN
				IF ((IRBIT1(ISEED).EQ.1)
     *				.AND.(IFLG.EQ.0)) THEN
					IFLG=1
					DELAY(J)=DELAY(J)+1.0
				ENDIF
12			CONTINUE
		ENDIF
13	CONTINUE
	WRITE(*,*) 'Distribution of runs of N zeros'
	WRITE(*,'(1X,T7,A,T16,A,T38,A)') 'N','Probability','Expected'
	DO 14 N=1,NBIN
		WRITE(*,'(1X,I6,F18.6,F20.6)') 
     *			N-1,DELAY(N)/IPTS,1/(2.0**N)
14	CONTINUE
	END
	PROGRAM D7R11
C	Driver for routine IRBIT2
C	Calculate distribution of runs of zeros
	PARAMETER(NBIN=15,NTRIES=10000)
	DIMENSION DELAY(NBIN)
	ISEED=111
	DO 11 I=1,NBIN
		DELAY(I)=0.0
11	CONTINUE
	IPTS=0
	DO 13 I=1,NTRIES
		IF (IRBIT2(ISEED).EQ.1) THEN		
			IPTS=IPTS+1
			IFLG=0
			DO 12 J=1,NBIN
				IF ((IRBIT2(ISEED).EQ.1)
     *				.AND.(IFLG.EQ.0)) THEN
					IFLG=1
					DELAY(J)=DELAY(J)+1.0
				ENDIF
12			CONTINUE
		ENDIF
13	CONTINUE
	WRITE(*,*) 'Distribution of runs of N zeros'
	WRITE(*,'(1X,T7,A,T16,A,T38,A)') 'N','Probability','Expected'
	DO 14 N=1,NBIN
		WRITE(*,'(1X,I6,F18.6,F20.6)') 
     *			N-1,DELAY(N)/IPTS,1/(2.0**N)
14	CONTINUE
	END
