Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site pucc-i
Path: utzoo!watmath!clyde!burl!mgnetp!ihnp4!inuxc!pur-ee!CS-Mordred!Pucc-H:Pucc-I:ags
From: ags@pucc-i (Seaman)
Newsgroups: net.bugs.4bsd,net.lang.lisp
Subject: Re: franz lisp (random) bug
Message-ID: <317@pucc-i>
Date: Thu, 14-Jun-84 12:03:08 EDT
Article-I.D.: pucc-i.317
Posted: Thu Jun 14 12:03:08 1984
Date-Received: Sat, 16-Jun-84 03:02:48 EDT
References: <134@godot.UUCP>
Organization: Purdue University Computing Center
Lines: 26

>  In the 4.2bsd franz (I don't know about others), (random) has the 
>  extremely non-random property of alternating even and odd numbers.

Knuth (Vol. 2, Seminumerical Algorithms) makes the following observations
about random number generators of the linear congruential type:
(m = modulus, w = word size)

1. Using m = w has an enormous advantage in speed, since it avoids the
   need for a divide.

2. When m = w, the right-hand digits of the generated numbers are much less
   random than the left-hand digits (this explains the even-odd behavior).

3. A reasonable alternative is to use m = (w plus or minus 1), which makes
   the right-hand digits more random at the cost of time.

4. "In most applications, the low-order bits are insignificant, and the 
   choice m=w is quite satisfactory -- provided that the programmer using
   the random numbers does so wisely."  (this a direct quote)

The man entry for rand(3) points out that random(3) should be used in
new applications and that rand remains for compatibility.
-- 

Dave Seaman			"My hovercraft is full of eels."
..!pur-ee!pucc-i:ags