From mboxrd@z Thu Jan 1 00:00:00 1970 From: wkt@tuhs.org (Warren Toomey) Date: Thu, 1 Apr 2010 08:20:02 +1000 Subject: [TUHS] Origins of drand48()? Message-ID: <20100331222002.GA28694@minnie.tuhs.org> 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 #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