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

⟦1d6243d52⟧ Ada Source

    Length: 2048 (0x800)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Random_Numbers, seg_05829d

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



with Calendar;
use Calendar;
package body Random_Numbers is
    function Random_Int (R : Integer) return Integer is
        Rvar : Float;
    begin
        -- the values used for random number generation avoid overflow
        -- on 16 bit (and larger) machines.
        -- The values are as given in Gimpel, Programming in SNOBOL.
        Rand_Seed := (Rand_Seed * 59) mod 491;
        Rvar := Float (Rand_Seed) / 491.0;
        -- assume machine rounds, so use r-1
        return Integer (Rvar * Float (R - 1));

    end Random_Int;

    procedure Set_Seed (R : Integer) is
    begin
        Rand_Seed := R;
    end Set_Seed;

begin
    -- set initial value from clock (avoid overflow if 16 bit integers)
    Rand_Seed := Integer (Float (Seconds (Clock)) / 200.0);
end Random_Numbers;

E3 Meta Data

    nblk1=1
    nid=0
    hdr6=2
        [0x00] rec0=1c rec1=00 rec2=01 rec3=000
    tail 0x2176588da87e280a2448c 0x42a00088462060003