Subject: random/srandom (was Re: link problems)
From: [email-masked] (Fabio Somenzi)

1 May 1997 12:18:35 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <[email-masked]>
	<[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Original-To: [email-masked]
In-Reply-To: <[email-masked]>
X-Mailer: VM 6.29 under Emacs 19.33.1
Original-Sender: [email-masked]

>>>>> "GN" == Geoffrey Noer <[email-masked]> writes:

 GN> James Paul Morgan wrote:
 >>  As far as I can tell, the gnu-win32 does not have the random and
 >> srandom functions.  It only has the rand and srand functions,
 >> which are not nearly as random.  I have had problems with moving
 >> software from an AIX system to my Win95 system becuase of this.
 GN> [...]

 GN> You are correct.  We have not implemented these yet as of the
 GN> upcoming beta 18 release.

 GN> If someone can point me to a Berkeley-licensed implementation of
 GN> them or write them and send me a copyright assignment form, I'll
 GN> add them...

I'm currently away from my Win95 laptop, but I just want to point out
that the botched rand function can be identified by looking at the
least significant bit:  It looks random for a good implementation, but
it's a periodic 0-1 sequence for many rand's. On my Linux box at the
office, rand and random are the same function and both are "good."
Maybe the Linux code is a good starting point for inclusion in cygwin.

On a related note, I've given up some time ago relying on system
functions to generate random numbers. I use my own, which I derived
from the algorithms in "Numerical Recipes in C." This is not to say
that cygwin shouldn't provide a decent random/srandom pair. It's just
that if you rely on the random number generator for more than an
extemporary exercise, and you want reproducibility of results, you
should seriously consider using your own random number generator.

Fabio

-- 
Fabio Somenzi          | Phone: 303-492-3466
University of Colorado | Fax:   303-492-2758
ECE Dept.              | Email: [email-masked]
Boulder CO 80309-0425  | WWW:   http://vlsi.colorado.edu/~fabio
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".