[TUHS] Origins of drand48()?

Warren Toomey wkt at tuhs.org
Thu Apr 1 08:20:02 AEST 2010


I was idly going through the 1999 Swartz memo
(http://www.groklaw.net/pdf/Swartz.pdf), wherein the source code of
RedHat 5.2 and UnixWare are compared for similarities. Most of those
are either bogus (just some #includes) or BSD-derived code. There is
one file which is concerning: drand48.c. The RedHat 5.2 file is very
similar to the UnixWare file, including headers and #ifdef's e.g.

/*      @(#)drand48.c   2.2     */
/*LINTLIBRARY*/
/*
 *      drand48, etc. pseudo-random number generator
 *      This implementation assumes unsigned short integers of at least
 *      16 bits, long integers of at least 32 bits, and ignores
 *      overflows on adding or multiplying two unsigned integers.
 *      Two's-complement representation is assumed in a few places.
 *      Some extra masking is done if unsigneds are exactly 16 bits
 *      or longs are exactly 32 bits, but so what?
 *      An assembly-language implementation would run significantly faster.
 */

#include <stdlib.h>

#ifndef HAVEFP
#define HAVEFP 1
#endif

As far as I can determine, drand48() arrived in SysVR1 and is defined
in the first SVID. It doesn't appear in SysIII, nor in the early BSDs.
Can anybody shed some light on drand48()? Could it have been written
elsewhere and made available e.g on a Usenix tape or comp.sources.*,
and included into SysV, or is SysV the origin of the code?

I'm sure the algorithm comes from elsewhere, e.g. Knuth, but the
strong code similarity is a worry.

Thanks,
	Warren
_______________________________________________
TUHS mailing list
TUHS at minnie.tuhs.org
https://minnie.tuhs.org/mailman/listinfo/tuhs



More information about the TUHS mailing list