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 [IPv6:2600:3c01:e000:146::1]) by inbox.vuxu.org (Postfix) with ESMTP id BED7728A65 for ; Wed, 13 Mar 2024 18:18:13 +0100 (CET) Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id B347A427C6; Thu, 14 Mar 2024 03:18:08 +1000 (AEST) Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by minnie.tuhs.org (Postfix) with ESMTPS id D9A27427C4 for ; Thu, 14 Mar 2024 03:17:59 +1000 (AEST) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2d27fef509eso322781fa.3 for ; Wed, 13 Mar 2024 10:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710350278; x=1710955078; 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=StVMw6Ykz4BliDzsQjdvsMkg3kEyg6qhE2FLKR3Ic4I=; b=nFRcqKreRjYzyyw6ML4se6vPSR9bk/zu5zm41xlpuhOf6jySP+xSoaqhaIqYjebfO3 bnzVc1EVXfRK37RQi4RK9zx7yVnvVqVe+V0ENUvK9OdGXtQvvP3Z5NHUQLi88fiz8i0y y+/g6O5x2FiFe9zGVlO3U5+JQcfCThLQgP5ZpTZEVZQayHnrRNbans7WUO1bxRfwn/SF ymMmodLeUSuBa97ojz0yKyUOMGP/o9tAI8IbAM7eCSzUo4sDLX69YQJdEKdDzqEH4wZN 8BUj5UiEp5eex0cSiUljvVz83k5KUqS33LW4vSNqCSerdf9f3tKQ1UnoQa9WOrqOEA6F PABg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710350278; x=1710955078; 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=StVMw6Ykz4BliDzsQjdvsMkg3kEyg6qhE2FLKR3Ic4I=; b=oCOnFL+wTMRyjZA5/bZz76pPyaIsWomaJjX/yUKtg8AChVGWibPMFC+Cu0ltKX2ETG PDW0vGO9tTjh1IEBsCfRMARjeoWwbOKCP6XYdW9PzKIlH8vaNbpYH0xeZhVPyIMx6wqU NjqiTv+tI/MWijaYINWzWGLdMniMnhaGmH85B6JZMdeil2y3Q0Xpe/mojzWp7reEokUJ B0JSnmWXnhXQh0rxmmLdzVbW7MPf7GZahZpscqtMplNw6WUXyfF8l3EymoO2MURd/7zV /NuySBFOjtwbj5P47IXF6AT6eItZ9lO+9N/dFbCRJQZqV+iBnIqjoU2wY1SWZXPkZAsn FPDA== X-Forwarded-Encrypted: i=1; AJvYcCXF8YbxX0ytXv65X3W1z5iMAYiYYLe9qp0zWFQdsAwnSOO8nDYtIfe/sH2Dl11FjVpo2dZUz8ZXEGQgmF3c X-Gm-Message-State: AOJu0YwjB4c40VTTxLZWpWOiRcfvkJpAJIaujIQXPeJG4Pas8XACYM3A 2PyghgJFBljIKhWBFiIxF5/ky8ZdRq1mzfoRV9DHffltT8nG4mKc1/l7CrH7T0fGsnXWGSTfePE ehCDs9s4Xzy1xXmUYPOswpdMG9q86n+xtMBM= X-Google-Smtp-Source: AGHT+IGO3ePt8Q4PSx1VsZ8yr3Aa/qde1zH3xemUaZz4fUy11mEseUw/fPOmKoXbYNpMaLuWQYZf9SKRjC3cW9VZ6sY= X-Received: by 2002:a2e:7812:0:b0:2d4:142:488a with SMTP id t18-20020a2e7812000000b002d40142488amr9094218ljc.8.1710350277949; Wed, 13 Mar 2024 10:17:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: ron minnich Date: Wed, 13 Mar 2024 10:17:45 -0700 Message-ID: To: Jonathan Gray Content-Type: multipart/alternative; boundary="000000000000c2451a06138df4e9" Message-ID-Hash: XHBMLW2OKXELO3SKXSDR6253TRNS7VON X-Message-ID-Hash: XHBMLW2OKXELO3SKXSDR6253TRNS7VON X-MailFrom: rminnich@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: 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: --000000000000c2451a06138df4e9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 wr= ote: > 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 Amdah= l > said that was a pretty hot topic there. Certainly, the technique of desig= n > 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 there > 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 no= t > ... 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 migh= t 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/ma= n3/rand.3 >>> > [2] >>> > >>> https://github.com/dspinellis/unix-history-repo/blob/Research-V2/cmd/ba= s0.s >>> > [3] >>> > >>> https://github.com/dspinellis/unix-history-repo/blob/Research-V6/usr/so= urce/s3/rand.s >>> >> --000000000000c2451a06138df4e9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Got the name wrong:=C2=A0Computer Engineering: A DEC View = of Hardware Systems Design

On Wed, Mar 13, 2024 at 9:41=E2=80=AFAM ron minni= ch <rminnich@gmail.com> wro= te:
by the way, I realize that random number urban legend sounds ridiculou= s, in light=C2=A0of how hardware design is done today, but those of you who= did hardware design in those days (guilty!), and had access to -11 schemat= ics=C2=A0and boards, might=C2=A0wonder if it's not possible. There was = a habit, in those days,=C2=A0 for performance reasons, of subbing transpare= nt 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&= #39;s book "Computer Design" is particularly=C2=A0instructive.=C2= =A0

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 computa= tion, see if there is disagreement, you've found a bug in the new machi= ne, right? 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 360 to 370 transition.

On Tue, Mar 12, 2024 at 6:09=E2=80=AFPM ron= minnich <rminni= ch@gmail.com> wrote:
There used to be an urban legend about multip= ly 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 t= hat might explain this code.=C2=A0

On Tue, Mar 12, 2024 at 16:05 Jonath= an Gray <jsg@jsg.id.a= u> 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=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=
--000000000000c2451a06138df4e9--