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

⟦7647ab05f⟧ TextFile

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

Derivation

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

TextFile

  message div random procedurer (tsystest2);

  zone zrandom (128 * 3, 3, xstderror);
  real field randompil;

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

    if test then write (out, "nl", 1, <:random: open:>);
    resetrandom;
  end procedure initrandom;

  procedure exitrandom;
  begin
    integer s;
    getposition (zrandom, 0, s);

    if test then write (out, "nl", 1, <:random: close no.:>, <<d>,
      randompil, <: seg.:>, s);

    close (zrandom, true);
  end procedure exitrendom;

  procedure resetrandom;
  begin <* forfra *>
    integer s;
    getposition (zrandom, 0, s);

    if test then write (out, "nl", 1, <:random: reset no.:>, <<d>,
      randompil, <: seg.:>, s);

    randompil := 0;
    setposition (zrandom, 0, 0);
  end resetrandom;

  procedure nextrandom;
  begin <* næste tal *>
    if randompil >= 128000 then
    begin <* forfra *>
      if test
      then write (out, "nl", 1, <:random: turnaround no.:>, <<d>, randompil);

      resetrandom;
    end;

    if randompil mod 128 = 0 then
    begin
      if test
      then write (out, "nl", 1, <:random: newseg no.:>, <<d>, randompil);
      inrec6 (zrandom, 512);
    end;

    randompil := randompil + 1;
  end procedure nextrandom;

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

    comment
    if test then write (out, "nl", 1, <:random, nr.:>, <<ddddd>, randompil,
      <: integer::>, <<-dddddddd>, i, <: min::>, min, <: max::>, max);
  end procedure i_random;

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

    comment
    if test then write (out, "nl", 1, <:random, nr.:>, <<ddddd>, randompil,
      <: long::>, <<-dddddddddddd>, l, <: min::>, min, <: max::>, max);
  end procedure l_random;

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

    comment
    if test then write (out, "nl", 1, <:random, nr.:>, <<ddddd>, randompil,
      <: real::>, <<-d.ddddddddd'-ddd>, r, <: min::>, min, <: max::>, max);
  end procedure r_random;

▶EOF◀