DataMuseum.dk

Presents historical artifacts from the history of:

RC4000/8000/9000

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

See our Wiki for more about RC4000/8000/9000

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦519ae2649⟧ TextFile

    Length: 3072 (0xc00)
    Types: TextFile
    Names: »trandom     «

Derivation

└─⟦9ccaf6601⟧ Bits:30008165 Bånd med SW8000 kildetekst/release værktøjer
    └─⟦f546e193b⟧ 
        └─⟦this⟧ »trandom     « 

TextFile

p=algol list.yes blocks.yes
begin
  integer rand, antal, i, j;

  message div random procedurer (tcputest2);

  zone zrandom (128, 1, stderror);
  real field randompil;

  procedure initrandom (name);
  string name;
  begin
    open (zrandom, 4, name, 1 shift 9);
    resetrandom;
  end procedure initrendom;

  procedure exitrandom;
  begin
    close (zrandom, true);
  end procedure exitrendom;

  procedure resetrandom;
  begin <* forfra *>
    randompil := 0;
    setposition (zrandom, 0, 0);
  end resetrandom;
  
  procedure nextrandom;
  begin <* næste tal *>
    if randompil >= 128000 then
    begin <* forfra *>
      randompil := 0;
      setposition (zrandom, 0, 0);
    end;
    if randompil mod 128 = 0 then inrec6 (zrandom, 512);
    randompil := randompil + 1;
  end procedure nextrandom;

  integer procedure i_random (min, max);
  value min, max;
  integer min, max;
  begin <* returnerer integer: min <= tal <= max *>
    nextrandom;
    i_random := zrandom (randompil mod 128 + 1) * (extend max - extend min) + min;
  end procedure i_random;

  long procedure l_random (min, max);
  value min, max;
  long min, max;
  begin <* returnerer long: min <= tal <= max *>
    nextrandom;
    l_random := zrandom (randompil mod 128 + 1) * (max - min) + min;
  end procedure l_random;

  real procedure r_random (min, max);
  value min, max;
  real min, max;
  begin <* returnerer real: min <= tal <= max *>
    nextrandom;
    r_random := zrandom (randompil mod 128 + 1) * (max - min) + min;
  end procedure r_random;

\f


  i := antal := rand := randompil := 0;
  initrandom (<:cputestrand:>);

  repeat
    if randompil mod 128 = 0 then
    begin
      outchar (out, '.');
      setposition (out, 0, 0);
      outrec6 (zrandom, 512);
    end;

    zrandom (randompil mod 128 + 1) := random (rand);
    randompil := randompil + 1;
  until randompil = 128000;
  exitrandom;

  write (out, "nl", 1, <:Ok:>, "nl", 1);
  setposition (out, 0, 0);

  initrandom (<:cputestrand:>);
  for i := 0 step 1 until 5 do
  begin
    write (out, "nl", 1, "ff", 1,
      case i mod 3 + 1 of (<:integer:>, <:long:>, <:real:>),
      "nl", 1);
      
    resetrandom;
    for j := 1 step 1 until 60 do
    case i mod 3 + 1 of
    begin
      write (out, "nl", 1, <<ddd>, randompil,
        <<-dddddddddddd_______>,
        irandom (-8388607, 8388605), 
        irandom (0, 8388605), 
        irandom (-8388607, 0),
        irandom (-5, 5));
        
      write (out, "nl", 1, <<ddd>, randompil,
        <<-dddddddddddd_______>,
        lrandom (-1000000000, 1000000000), 
        lrandom (0, 1000000000), 
        lrandom (-1000000000, 0),
        lrandom (0, 10));
        
      write (out, "nl", 1, <<ddd>, randompil,
        <<-dddddddddd'-ddd____>,
        rrandom (-1000000000, 1000000000), 
        rrandom (0, 1000000000), 
        rrandom (-1000000000, 0),
        rrandom (0, 1));
    end case;   
  end for i;

  exitrandom;
end

if warning.no
p

end
▶EOF◀