	PROGRAM RAND

C	THIS PROGRAM WILL TRANSLATE THE RANDOM SEQUENCE NUMBERS GENERATED
C	BY 'RAN' INTO MESSAGE TYPE NUMBER AND NUMBER OF BLOCKS WRITTEN
C	BY MESSAGE.  ABORT PROGRAM WHEN ENOUGH INFO HAS BEEN PRINTED.

	WRITE (5,1000)
1000	FORMAT('$ENTER ''BLOCK SIZE OF MSG'' RANDOM SEED USED IN ',
	1      '''WRTQ'' > ')
	READ  (5,1010,END=2000) I
1010	FORMAT(I3)
	WRITE (5,1020)
1020	FORMAT('$ENTER ''MESSAGE TYPE'' RANDOM SEED USED ',
	1      'IN ''WRTQ'' > ')
	READ  (5,1030,END=2000) J
1030	FORMAT(I3)
	WRITE (5,1040)
1040	FORMAT(' ENTER ''0'' FOR ONLY TYPE 0 MESSAGES,'
	1      /'       ''1'' FOR ONLY TYPE 1 MESSAGES,'
	2      /'$      ''2'' FOR BOTH TYPES OF MESSAGES > ')
	READ  (5,1050,END=2000) MSGTYP
1050	FORMAT(I1)
	
1500	X = RAN(I)
CC	TYPE *,'X = ',X
	IBLKS = X * 10.0
	IF (IBLKS.EQ.0) THEN
		IBLKS = 1
	ELSE IF (IBLKS.EQ.9) THEN
		IBLKS = 8
	END IF
	TYPE *,'MESSAGE SIZE IN BLOCKS = ',IBLKS

	IF (MSGTYP.EQ.0) THEN
		ITYPE = 0
	ELSE IF (MSGTYP.EQ.1) THEN
		ITYPE = 1
	ELSE 
		Y = RAN(J)
CC		TYPE *,'Y = ',Y
		IF (Y.LT.0.5) THEN 
			ITYPE = 0
		ELSE
			ITYPE = 1
		END IF
	END IF
	TYPE *,'TYPE = ',ITYPE	

	GOTO 1500			! LOOP FOREVER
	
2000	CONTINUE
	END	
