From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from minnie.tuhs.org (minnie.tuhs.org [50.116.15.146]) by inbox.vuxu.org (Postfix) with ESMTP id 5319722284 for ; Wed, 13 Mar 2024 21:25:47 +0100 (CET) Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id B73D5427DA; Thu, 14 Mar 2024 06:25:43 +1000 (AEST) Received: from mail-ua1-x933.google.com (mail-ua1-x933.google.com [IPv6:2607:f8b0:4864:20::933]) by minnie.tuhs.org (Postfix) with ESMTPS id 9AF8D427D4 for ; Thu, 14 Mar 2024 06:25:37 +1000 (AEST) Received: by mail-ua1-x933.google.com with SMTP id a1e0cc1a2514c-7d5bfdd2366so108294241.3 for ; Wed, 13 Mar 2024 13:25:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710361536; x=1710966336; darn=tuhs.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=sKzbUmUq8mduu1kWs7Y3WFCZHJMfoEDvYMauGSU5lg4=; b=R1EmL27c+fEr1WrMenzyMh78xGpp2OrxHqCMmZc2hVs4dHhm/49NNV3E3sKBsudAo5 Ymwr655vNx73AhX3aF7hTLN3ZfVi6nKfAMDcZGs14YoQOzCLmYrWpFGS/Dy8fHJybpMT oK+vfd5ERQIXXHl8OPsElZaCH14K6yWH1tVseQBvBNwgLveBr2YSlXidCRAslqQdtqiC UBNjlu2G3vPnDZ+ZBNvyMi/KPKHwJnvaaCMZAfqVHe8PGb3GkqKIGBj5qDX/nD3gGUTu 77B4oK25qBPiZyxHEGG2UdAtm6hhyFTzwePLDR2wPZtDIfiiiV2YRMqwG/fzRKqn/48F CeJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710361536; x=1710966336; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sKzbUmUq8mduu1kWs7Y3WFCZHJMfoEDvYMauGSU5lg4=; b=bZwjne3lS/l36vFa01DZF4FQygE31p84VXIpCrcGa3wTaJZqNZGw/alqUV9kuYcgub IQ6Z2XK8rmb5U8mn8pq31eTq06oszGo+JCZY30uZEC9xgJ6IDhWuYKwTkXSS4soVk0ft 8ZOml+qn/dNPL1po3J1Ewy727MsoUcPgNqHFpAcq0yFHAxE57RwrFK86F+geBuzgigw0 I5jOmraB3OBwOzUOjQLSkFNilvpnZIL87Dk9iPvEXGCK6fvqLn4rmWNmLfjjWvo2ILy8 p8BunjVL96RS8QdFyjfmtP3sQI/rfe+DPS1Ta6fIMMox8nkqvHxGGTT84dKzcRx5KMeJ oHrw== X-Forwarded-Encrypted: i=1; AJvYcCXgeiYcMcj5J4+MB7PppAhByWggMNCu7vPPLbIMSSTk21zh4XbR9NYFkXg9k/TtKhzgDfMTkyhtZ4PY08ED X-Gm-Message-State: AOJu0YxabAqqr4442XILxZNGFWpkAfdp5ieoOuykiEIMb2Cyryn6wJML /GjkbPmGOII0UglIzAO9Q1CoiVOwn5Ws+wSrqQgQWGsgvhHBRqsFIoUha413zFwGmpUALwAjcml /NOiv6Ias4pX8sFRaW5ju82/KQoY= X-Google-Smtp-Source: AGHT+IGXOSIyO6tGgp695f0uKjPXl8SVRJZzsss3o5/Dm9/DUX5upHVB/4Y7jnQ9mUq7mP34AgoMMjvr/NJO7sGUIi0= X-Received: by 2002:a67:f590:0:b0:474:cf85:3c61 with SMTP id i16-20020a67f590000000b00474cf853c61mr39696vso.11.1710361536209; Wed, 13 Mar 2024 13:25:36 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Rob Pike Date: Thu, 14 Mar 2024 07:25:25 +1100 Message-ID: To: ron minnich Content-Type: multipart/alternative; boundary="000000000000cdace8061390935b" Message-ID-Hash: I54GPXEEN7VGFI3RXYROCYNCO3AWRG6Z X-Message-ID-Hash: I54GPXEEN7VGFI3RXYROCYNCO3AWRG6Z X-MailFrom: robpike@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Jonathan Gray , Russ Cox , tuhs@tuhs.org X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [TUHS] Re: early unix rand List-Id: The Unix Heritage Society mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --000000000000cdace8061390935b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Norm Schryer wrote a (nearly?) exhaustive floating-point tester that he ran when a new CPU arrived, always with wrong results. Doug McIlroy probably knows more about it than I do, who only observed it from afar. -rob On Thu, Mar 14, 2024 at 4:18=E2=80=AFAM ron minnich wr= ote: > Got the name wrong: Computer Engineering: A DEC View of Hardware Systems > Design > > On Wed, Mar 13, 2024 at 9:41=E2=80=AFAM ron minnich = wrote: > >> by the way, I realize that random number urban legend sounds ridiculous, >> in light of how hardware design is done today, but those of you who did >> hardware design in those days (guilty!), and had access to -11 >> schematics and boards, might wonder if it's not possible. There was a >> habit, in those days, for performance reasons, of subbing transparent >> latches for flip-flops to gain a little time. An engineer I knew at Amda= hl >> said that was a pretty hot topic there. Certainly, the technique of desi= gn >> for testability was not really in wide use in the -11 days. Gordon Bell'= s >> book "Computer Design" is particularly instructive. >> >> E.g., how did you verify the floating point on your new machine? Put an >> older machine next to a new machine, do lots of computation, see if ther= e >> is disagreement, you've found a bug in the new machine, right? Maybe. >> Sometimes, you discover the older machine had a bug the newer one did n= ot >> ... happened more than once, including on the 360 to 370 transition. >> >> On Tue, Mar 12, 2024 at 6:09=E2=80=AFPM ron minnich = wrote: >> >>> There used to be an urban legend about multiply overflow and the PDP 11= . >>> >>> This would=E2=80=99ve been circa 1976. Someone from DEC told us that on= a >>> multiply overflow, the contents of the destination register would be = =E2=80=9Ckind >>> of=E2=80=9D random. I was never able to verify that claim. But that mig= ht explain >>> this code. >>> >>> On Tue, Mar 12, 2024 at 16:05 Jonathan Gray wrote: >>> >>>> On Tue, Mar 12, 2024 at 08:55:02AM -0400, Russ Cox wrote: >>>> > Hi all (and TUHS), >>>> > >>>> > The Third Edition rand(III) page [1] ends with >>>> > >>>> > WARNING The author of this routine has been writing >>>> > random-number generators for many years and has >>>> > never been known to write one that worked. >>>> > >>>> > My understanding is that Ken wrote the rand implementation. >>>> > But I'm curious about the origin of this warning. >>>> > I had assumed that Ken wrote it as a combination warning+joke, >>>> > but Rob suggested that to him it didn't sound like Ken and >>>> > perhaps Doug or Dennis had written it. Does anyone remember? >>>> > >>>> > Separately, I am trying to find out what the very first >>>> > Unix rand implementation was. In the TUHS archives, >>>> > the incomplete V2 sources contain a reference to srand >>>> > in cmd/bas0.s [2], but there is no definition in the tree. >>>> > The V3 man pages list it, but as far as I can tell full >>>> > library sources do not appear in the TUHS archives >>>> > until the V6 snapshot. The V6 rand [3] is: >>>> > >>>> > rand: >>>> > mov r1,-(sp) >>>> > mov ranx,r1 >>>> > mpy $13077.,r1 >>>> > add $6925.,r1 >>>> > mov r1,r0 >>>> > mov r0,ranx >>>> > bic $100000,r0 >>>> > mov (sp)+,r1 >>>> > rts pc >>>> >>>> matches V5: >>>> https://www.tuhs.org/cgi-bin/utree.pl?file=3DV5/usr/source/s3/rand.s >>>> Distributions/Research/Dennis_v5/v5root.tar.gz >>>> >>>> >>>> > >>>> > Perhaps this is the original rand as well? It is hard to imagine >>>> > a much simpler one, other than perhaps removing the addition, >>>> > but doing so would create a sequence of only odd numbers. >>>> > >From the man page description it sounds like this has to be the >>>> > original generator, perhaps with different constants. >>>> > >>>> > Thanks! >>>> > >>>> > Best, >>>> > Russ >>>> > >>>> > [1] >>>> > >>>> https://github.com/dspinellis/unix-history-repo/blob/Research-V3/man/m= an3/rand.3 >>>> > [2] >>>> > >>>> https://github.com/dspinellis/unix-history-repo/blob/Research-V2/cmd/b= as0.s >>>> > [3] >>>> > >>>> https://github.com/dspinellis/unix-history-repo/blob/Research-V6/usr/s= ource/s3/rand.s >>>> >>> --000000000000cdace8061390935b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Norm Schryer wrote a (nearly?) exhaustive floating-point tester t= hat he ran when a new CPU arrived, always with wrong results. Doug McIlroy = probably knows more about it than I do, who only observed it from afar.

<= /div>
-r= ob


On Thu, Mar 14, 2024 at 4:18=E2=80=AFAM ron minnich <rminnich@gmail.com> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">
Got the n= ame wrong:=C2=A0Computer Engineering: A DEC View of Hardware Systems Design=

= On Wed, Mar 13, 2024 at 9:41=E2=80=AFAM ron minnich <rminnich@gmail.com> wrote:
<= /div>
by = the way, I realize that random number urban legend sounds ridiculous, in li= ght=C2=A0of how hardware design is done today, but those of you who did har= dware design in those days (guilty!), and had access to -11 schematics=C2= =A0and boards, might=C2=A0wonder if it's not possible. There was a habi= t, in those days,=C2=A0 for performance reasons, of subbing transparent lat= ches for flip-flops to gain a little time. An engineer I knew at Amdahl sai= d that was a pretty hot topic there. Certainly, the technique of design for= testability was not really in wide use in the -11 days. Gordon Bell's = book "Computer Design" is particularly=C2=A0instructive.=C2=A0
E.g., how did you verify the floating point on your new ma= chine? Put an older machine next to a new machine, do lots of computation, = see if there is disagreement, you've found a bug in the new machine, ri= ght? Maybe. Sometimes,=C2=A0 you discover=C2=A0the older machine had a bug = the newer one did not ... happened=C2=A0more than once, including on the 36= 0 to 370 transition.

On Tue, Mar 12, 2024 at 6:09=E2=80=AFPM ron minni= ch <rminnich@gma= il.com> wrote:
There used to be an urban legend about multiply ove= rflow and the PDP 11.

Th= is would=E2=80=99ve been circa 1976. Someone from DEC told us that on a mul= tiply overflow, the contents of the destination register would be =E2=80=9C= kind of=E2=80=9D random. I was never able to verify that claim. But that mi= ght explain this code.=C2=A0

On Tue, Mar 12, 2024 at 16:05 Jonathan Gra= y <jsg@jsg.id.au&= gt; wrote:
On Tu= e, Mar 12, 2024 at 08:55:02AM -0400, Russ Cox wrote:
> Hi all (and TUHS),
>
> The Third Edition rand(III) page [1] ends with
>
> WARNING=C2=A0 The author of this routine has been writing
>=C2=A0 =C2=A0 =C2=A0random-number generators for many years and has
>=C2=A0 =C2=A0 =C2=A0never been known to write one that worked.
>
> My understanding is that Ken wrote the rand implementation.
> But I'm curious about the origin of this warning.
> I had assumed that Ken wrote it as a combination warning+joke,
> but Rob suggested that to him it didn't sound like Ken and
> perhaps Doug or Dennis had written it. Does anyone remember?
>
> Separately, I am trying to find out what the very first
> Unix rand implementation was. In the TUHS archives,
> the incomplete V2 sources contain a reference to srand
> in cmd/bas0.s [2], but there is no definition in the tree.
> The V3 man pages list it, but as far as I can tell full
> library sources do not appear in the TUHS archives
> until the V6 snapshot. The V6 rand [3] is:
>
> rand:
>=C2=A0 =C2=A0 =C2=A0mov r1,-(sp)
>=C2=A0 =C2=A0 =C2=A0mov ranx,r1
>=C2=A0 =C2=A0 =C2=A0mpy $13077.,r1
>=C2=A0 =C2=A0 =C2=A0add $6925.,r1
>=C2=A0 =C2=A0 =C2=A0mov r1,r0
>=C2=A0 =C2=A0 =C2=A0mov r0,ranx
>=C2=A0 =C2=A0 =C2=A0bic $100000,r0
>=C2=A0 =C2=A0 =C2=A0mov (sp)+,r1
>=C2=A0 =C2=A0 =C2=A0rts pc

matches V5:
https://www.tuhs.org/cgi-bin/utree.pl?file=3DV5/usr/source/s3= /rand.s
Distributions/Research/Dennis_v5/v5root.tar.gz


>
> Perhaps this is the original rand as well? It is hard to imagine
> a much simpler one, other than perhaps removing the addition,
> but doing so would create a sequence of only odd numbers.
> >From the man page description it sounds like this has to be the > original generator, perhaps with different constants.
>
> Thanks!
>
> Best,
> Russ
>
> [1]
> https://github.= com/dspinellis/unix-history-repo/blob/Research-V3/man/man3/rand.3
> [2]
> https://github.com/d= spinellis/unix-history-repo/blob/Research-V2/cmd/bas0.s
> [3]
> https://gi= thub.com/dspinellis/unix-history-repo/blob/Research-V6/usr/source/s3/rand.s=
--000000000000cdace8061390935b--