[TUHS] Origins of drand48()?
John Cowan
cowan at ccil.org
Thu Apr 1 11:23:00 AEST 2010
Warren Toomey scripsit:
> 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?
FWIW, the code appears in OpenSolaris with an AT&T 1988 copyright header.
It's been generified and given a CDDL license and Sun Microsystems 2008
copyright header.
There are a bunch of other copies floating around *without* an AT&T
copyright, e.g.
http://cs.nyu.edu/~yap/classes/visual/data/ply/cygwin-version/ply/drand48.c .
> I'm sure the algorithm comes from elsewhere, e.g. Knuth, but the
> strong code similarity is a worry.
It's a linear congruential generator with multiplier 25214903917,
addend 11, and modulus 2^48, so there's nothing special about that.
LCGs are indeed discussed in Knuth volume 2.
--
John Cowan cowan at ccil.org http://ccil.org/~cowan
Big as a house, much bigger than a house, it looked to [Sam], a grey-clad
moving hill. Fear and wonder, maybe, enlarged him in the hobbit's eyes,
but the Mumak of Harad was indeed a beast of vast bulk, and the like of him
does not walk now in Middle-earth; his kin that live still in latter days are
but memories of his girth and his majesty. --"Of Herbs and Stewed Rabbit"
_______________________________________________
TUHS mailing list
TUHS at minnie.tuhs.org
https://minnie.tuhs.org/mailman/listinfo/tuhs
More information about the TUHS
mailing list