[Oberon] Oberon Digest, Vol 212, Issue 12

Ka-Pe Er k_p_r at gmx.de
Wed Jan 12 11:07:30 CET 2022


[Once again, learning ...]


Moin from Kiel !

In a private e-mail Joerg thankfully sent me an OBERON07 version of
Sentences, which could relatively easily be converted into an OBERON-2
version.

All in all, now, after 30 years, (ETH-/ Wirth-) sample solutions for all
exercises of PiO would be desirable, because probably nowadays no
(ETH-)exercises for OBERON lectures could be "disturbed" by the
publication of these source texts.

We remain expectant, hoping for further sample solutions ...

Occasionally (NW will be 88 on 20220215 !) we will try to publish what
we have collected ...

[Translated with www.DeepL.com/Translator (free version)]

Thanks and Tschuess
kpr

Klaus-Peter Reimers
(Germany / Kiel)



On 11.01.22 12:00, oberon-request at lists.inf.ethz.ch wrote:
 >
 > Today's Topics:
 >
 >     1. Re: Is there anybody out there ... (J?rg)
 >
 >
 > ----------------------------------------------------------------------
 >
 > Message: 1
 > Date: Mon, 10 Jan 2022 15:59:10 +0100
 > From: J?rg <joerg.straube at iaeth.ch>
 > To: ETH Oberon and related systems <oberon at lists.inf.ethz.ch>
 > Subject: Re: [Oberon] Is there anybody out there ...
 > Message-ID: <47B793F4-A2AA-43FC-BD99-E6B3E6A89494 at iaeth.ch>
 > Content-Type: text/plain;    charset="UTF-8"
 >
 > Just for your info:
 > My jr.RandomNumbers.Mod in Oberon-07 looks like this:
 > I implemented the slightly better Park-Miller instead of the one you
find in Oberon books.
 > J?rg
 >
 > . . . . . . .
 > MODULE RandomNumbers; (* jr/3dec19 *)
 > IMPORT SYSTEM, Math;
 > CONST
 >     timer = -64;
 >
 > (* Park-Miller 1993 *)
 >     a = 48271; m = 7FFFFFFFH; q = m DIV a; r = m MOD a;
 >
 > VAR z*: INTEGER;
 >
 > PROCEDURE Time(): LONGINT;
 >     VAR msec: LONGINT; BEGIN SYSTEM.GET(timer, msec); RETURN msec END
Time;
 >
 >
 > PROCEDURE Uniform*(): REAL;                (* returns a random nbr 0
< x < 1 *)
 >     (*   z = a * z MOD m   by Schrage's method *)
 >     BEGIN
 >         z := a*(z MOD q) - r*(z DIV q);
 >         IF z < 0 THEN INC(z, m) END
 >     RETURN FLT(z) / FLT(m)
 >     END Uniform;
 >
 >
 > PROCEDURE RND*(max: INTEGER): INTEGER;        (* returns an integer
in the range 0..max-1 *)
 >     RETURN FLOOR(Uniform() * FLT(max))
 >     END RND;
 >
 >
 > PROCEDURE Exp*(mu: REAL): REAL;            (* returns an
exponentially distributed random number *)
 >     RETURN -Math.ln(Uniform())/mu END Exp;
 >
 >
 > PROCEDURE InitSeed*(seed: INTEGER);
 >     BEGIN
 >         IF seed = 0 THEN z := 1 ELSE z := seed END;
 >     END InitSeed;
 >
 > BEGIN
 >     InitSeed(Time())
 > END RandomNumbers.
 >
 > ORP.Compile jr.RandomNumbers.Mod/s ~
 > System.Free RandomNumbers ~
 > . . . . . . .


More information about the Oberon mailing list