delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/04/27/06:12:57

Message-Id: <200004270947.FAA27604@delorie.com>
From: "Dieter Buerssner" <buers AT gmx DOT de>
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Date: Thu, 27 Apr 2000 12:52:02 +0200
MIME-Version: 1.0
Subject: Re: rand() in libc
CC: djgpp-workers AT delorie DOT com
In-reply-to: <200004261107.HAA23684@indy.delorie.com>
References: <200004251736 DOT NAA26252 AT delorie DOT com> (buers AT gmx DOT de)
X-mailer: Pegasus Mail for Win32 (v3.12b)
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 26 Apr 00, at 7:07, Eli Zaretskii wrote:

> Assuming that Marsaglia's suite at the above URL is Free Software, it
> would be nice to add some or all of it to djtst distro, together with
> some driver program that would interpret the results in a way that can
> be understood by humans even if they don't know much about this
> subject.

The Fortran source code (and the extreme ugly f2c translation, you 
need to have f2c installed to compile and link it) of diehard is 
available. I have seen no license or copyright. I have the following
message of Marsaglia saved on disk:

|A question of copyright has also been raised.  Unlike
|DIEHARD, there is no copyright on the code [some source for PRNGs 
|Marsaglia posted] below. You are free to use it in any way you want, 
|but you may wish to acknowledge the source, as a courtesy.

I do have a C rewrite of diehard. It is somewhat ugly and makes in 
some places unportable assumptions about the sizes of the integral 
types. It is a merge of Marsaglias tests and some of my random number 
tests. In non-verbose mode my program may come close to what you have 
asked for. It will only report suspicious results. But something 
like:  "Congratulations, your PRNG has passed all tests" or "Sorry, 
your PRNG failed" is not easy possible. If you see a suspicious p-
value, you have to rerun the test (the PRNG will be seeded 
differently), and compare the results. And, of the many p-values 
calculated, some will always be suspicious.

> That would allow to quickly compare different implementations and/or
> small modifications in existing code.  Right now, the RNGs available
> in libc do not have *any* test suite.

I think, the only PRNG in libc, that may be changed, is rand(). The 
rand48 family seems to be what I know from Cray and/or some Unix 
variants. The random() seems to be BSD random. So changing (even 
advancing) these may break some code. (To test a port to djgpp, you 
may run a simulation and compare with the expected results.)
 
When there really is interest, I may be able to clarify the legal 
issuses. But I somewhat doubt the general usefulness of my program 
for DJGPP.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019