From:	CSBVAX::MRGATE!@KL.SRI.Com:graham@drcvax.arpa@SMTP 29-JUL-1987 16:54
To:	EVERHART
Subj:	IMPROVEMENT TO MY COOKIE PROGRAM

Received: from drcvax.arpa by KL.SRI.Com with TCP; Tue 28 Jul 87 13:27:28-PDT
Date: 28 Jul 87 16:12:00 EDT
From: <graham@drcvax.arpa>
Subject: IMPROVEMENT TO MY COOKIE PROGRAM
To: "info-vax" <info-vax@kl.sri.com>
Reply-To: <graham@drcvax.arpa>

Greetings cookie eaters:

Many of you have received my fortune cookie program.  (Many more probably 
will after they see this posting...it's O.K., though)  The random number 
generator in that program leaves something to be desired.  After a couple 
of suggestions, I have rewritten the portion of code that generates the 
random numbers.  It is short and works much better.

Here's how to modify the cookie.for program:

1. Delete all of the subroutine.

2. Make the data declaration lines at the top look like this:

	INTEGER*4 NUM,VALUE,VAL,COUNT,MAX,SEED
	REAL*4 SYSTIME,MTH$RANDOM,RNUM
	CHARACTER*80 LINE
	CHARACTER*1 NULL

3. delete thr line
	CALL RANDOM(NUM,MAX)

4. In it's place, enter the lines
	SYSTIME = SECNDS(0.0)
	SEED = ANINT(SYSTIME)
	NUM = 0
3	RNUM = MTH$RANDOM(SEED)
	NUM = ABS(RNUM) * 10000
	IF (NUM .EQ. 0 .OR. NUM .GT. MAX) GOTO 3

Recompile, link and you're set.


I hope this is better.  Good luck.

Dan Graham
GRAHAM@DRCVAX.ARPA
------
