The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: wkt@tuhs.org (Warren Toomey)
Subject: [TUHS] Origins of drand48()?
Date: Thu, 1 Apr 2010 08:20:02 +1000	[thread overview]
Message-ID: <20100331222002.GA28694@minnie.tuhs.org> (raw)

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



             reply	other threads:[~2010-03-31 22:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-31 22:20 Warren Toomey [this message]
2010-04-01  1:23 ` John Cowan
2010-04-01  2:01   ` Larry McVoy
2010-04-01  2:23     ` M. Warner Losh
2010-04-01  7:06     ` Michael Davidson
2010-04-01 23:39 ` Cyrille Lefevre
2010-04-02  0:17   ` John Cowan
2010-04-02  0:39     ` Larry McVoy
2010-04-02  1:10       ` Jason Stevens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100331222002.GA28694@minnie.tuhs.org \
    --to=wkt@tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).