[TUHS] Origins of drand48()?

Cyrille Lefevre cyrille.lefevre-lists at laposte.net
Fri Apr 2 09:39:19 AEST 2010


Warren Toomey a écrit :
> 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.
>  */
> 
> 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?

Hi Warern,

the older (c) I found is 1984, but SVR1 seems to be born in 1983 !
(http://en.wikipedia.org/wiki/UNIX_System_V say SVR2 is 1984)
as far as I recall me, SVID1 is SVR2, not SVR1.
(http://en.wikipedia.org/wiki/SVID say SVID1 is 1985)

11231 1995-07-18 23:34 ./aix/4.1.3/bos/usr/ccs/lib/libc/drand48.c
  * Copyright (c) 1984 AT&T
  * All Rights Reserved
...
  * drand48.c    1.7  com/lib/c/gen,3.1,8943 10/11/89 13:47:39

  4163 1989-09-21 22:59 ./irix/3.7/lib/libc/common/gen/drand48.c
no cpyr

  5627 1999-12-03 09:24 ./irix/6.5.5/f/irix/lib/libc/src/math/drand48.c
  5627 1999-12-03 09:31 ./irix/6.5.5/m/irix/lib/libc/src/math/drand48.c
/*      Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
/*      Copyright (c) 1988 AT&T */
/*        All Rights Reserved   */
...
  * Copyright 1995, Silicon Graphics, Inc.
  * All Rights Reserved.
...
  * Reimplementation of drand48 using 64-bit arithmetic.  Drand48 is
  *  a 48-bit linear congruential random number generator,
...

12882 1994-03-02 17:46 
./osf1/osf1src/usr/opt/OSC200/src/usr/ccs/lib/libc/drand48.c
  * *    Copyright (c) Digital Equipment Corporation, 1991, 1994    *
...
  * (c) Copyright 1990, 1991, 1992, 1993 OPEN SOFTWARE FOUNDATION, INC.
  * ALL RIGHTS RESERVED
...
  * (C) COPYRIGHT International Business Machines Corp. 1985, 1989
  * All Rights Reserved
...
  * Copyright (c) 1984 AT&T
  * All Rights Reserved
...
  * drand48.c    1.7  com/lib/c/gen,3.1,8943 10/11/89 13:47:39

  3279 1997-01-10 18:05 
./solaris/Solaris_2.6/os_net/src_ws/usr/src/lib/libbc/libc/gen/common/drand48.c
no cpyr
#pragma ident   "@(#)drand48.c  1.4     96/05/05 SMI" /* from S5R2 2.2 */

  5101 1997-01-10 18:05 
./solaris/Solaris_2.6/os_net/src_ws/usr/src/lib/libc/port/gen/drand48.c
/*      Copyright (c) 1988 AT&T */
/*        All Rights Reserved   */
...
#ident  "@(#)drand48.c  1.12    96/05/05 SMI"   /* SVr4.0 2.4.1.7       */

  5281 2000-10-14 18:08 
./solaris/Solaris_2.8/osnet_volume/usr/src/lib/libc/port/gen/drand48.c
/*      Copyright (c) 1988 AT&T */
/*        All Rights Reserved   */
...
  * Copyright(c) 1996, by Sun Microsystems, Inc.
  * All rights reserved.
...
#pragma ident   "@(#)drand48.c  1.14    96/11/15 SMI"   /* SVr4.0 2.4.1.7 */

  4247 1995-01-18 18:53 ./sunos/solaris_112/lib/libc/gen/common/drand48.c
no cpyr
static  char sccsid[] = "@(#)drand48.c 1.1 94/10/31 SMI"; /* from S5R2 
2.2 */

  4147 1992-07-22 17:26 ./ultrix/lib/libc/gen/drand48.c
/*      @(#)drand48.c   2.2     */

  4745 1994-01-23 00:02 ./usl/src/common/lib/libc/port/gen/drand48.c
/*      Copyright (c) 1990, 1991, 1992 UNIX System Laboratories, Inc.   */
/*      Copyright (c) 1988, 1990 AT&T   */
/*        All Rights Reserved   */
...
#ident  "@(#)libc-port:gen/drand48.c    2.4.2.1"

4514 Jan 23  1988 
./PDP-11/Distributions/dec/Ultrix-3.1-src/ultrix11-src.tar.gz/src/libc/sysV/drand48.c
  *   Copyright (c) Digital Equipment Corporation 1984, 1985, 1986.    *
  *   All Rights Reserved.                                             *
...
/*      SCCSID: @(#)drand48.c   3.0     4/22/86 */
/*      (System 5)      2.2     */

Regards,

Cyrille Lefevre
-- 
mailto:Cyrille.Lefevre-lists at laposte.net


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



More information about the TUHS mailing list