Alexander Gromnitsky's Blog

An RNG in the 1st versions of fortune(6)

Latest update:

From: Dennis Ritchie <dmr@bell-labs.com>
Subject: Re: When giants walked the earth (was: 1130)
Date: 1998/05/02
Message-ID: <354A5F96.FD6@bell-labs.com>
Organization: Bell Labs, Lucent Technologies
Newsgroups: alt.folklore.computers

Tom Van Vleck wrote (quoting alderson):

> > No, it wasn't.  It originated at the Stanford Artificial
> > Intelligence Lab;
>
> Perhaps we have a case of parallel invention.  I wrote a program
> that uttered a random remark on each invocation in MAD for CTSS in
> 1965, for my own amusement.  It is possible that some of my Bell
> Labs colleagues on the Multics development project were aware of
> this program.

I don't know where the Unix fortune program came from.  It appeared in
the 7th edition (1979) but wasn't in the 6th (1975).  I doubt that it
was parallel invention, rather derivative adaptation, but the time gap
between v7 and 1965 CTSS is large enough that it's doubtful that TVV's
version was the immediate ancestor.  It could indeed be SAIL.

Incidentally, this program figured in an amusing story, somewhat
later, that tends to validate a notation that Bob Morris had in an
early manual in the rand (III) section: "The author of this routine
has been writing random number generators for many years, but has
never written one that works."  (Referring to Ken Thompson).

Several had observed that even though there were many thousands of
fortunes in the file, they kept seeing the same ones over and over
again.  The fortune is selected by flipping a figurative coin (using
rand()).  It turned out that although the RNG was actually reasonably
good asymptotically, after it was initialized it took a while to
achieve the good behavior.  Fortune, of course, reset the RNG each
time the command was invoked and used the first, biased values from
it.

    Dennis

Tags: quote, ойті
Authors: ag