DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦28451688d⟧ Ada Source

    Length: 3072 (0xc00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Random, seg_05830e

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦this⟧ 

E3 Source Code



--::::::::::
--random.adb
--::::::::::
with Calendar;
use Calendar;

package body Random is

-- Body of random number generator package.
-- Adapted from the Ada literature by
-- Michael B. Feldman, The George Washington University, November 1990.

    Modulus : constant := 9317;

    type Int_16 is range -2 ** 15 .. 2 ** 15 - 1;

    type Int_32 is range -2 ** 31 .. 2 ** 31 - 1;

    subtype Seed_Range is Int_16 range 0 .. (Modulus - 1);

    Seed, Default_Seed : Seed_Range;
    procedure Set_Seed (N : Positive) is
    begin
        Seed := Seed_Range (N);
    end Set_Seed;
    function Unit_Random return Float is
        Multiplier : constant := 421;
        Increment : constant := 2073;
        Result : Float;
    begin
        Seed := (Multiplier * Seed + Increment) mod Modulus;
        Result := Float (Seed) / Float (Modulus);
        return Result;
    exception
        when Constraint_Error | Numeric_Error =>
            Seed := Int_16
                       ((Multiplier * Int_32 (Seed) + Increment) mod Modulus);
            Result := Float (Seed) / Float (Modulus);
            return Result;
    end Unit_Random;
    function Random_Int (N : Positive) return Positive is
        Result : Integer range 1 .. N;
    begin
        Result := Integer (Float (N) * Unit_Random + 0.5);
        return Result;
    exception
        when Constraint_Error | Numeric_Error =>
            return 1;

    end Random_Int;


end Random;


E3 Meta Data

    nblk1=2
    nid=0
    hdr6=4
        [0x00] rec0=25 rec1=00 rec2=01 rec3=01e
        [0x01] rec0=13 rec1=00 rec2=02 rec3=001
    tail 0x217658e5a87e288ce0a4c 0x42a00088462060003