home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 349_01 / sss.arc / EX_0301.PAS < prev    next >
Pascal/Delphi Source File  |  1991-04-09  |  746b  |  46 lines

  1. Program EX_0301;
  2. {Listing 4P - see documentation in TUTOR.SSS}
  3.  
  4. uses SSS;
  5. { For Pascal other than Turbo/Quick erase above line }
  6.  
  7. const
  8.   FREE=0;
  9.   BUSY=1;
  10.  
  11. { For MS Pascal $include:'SSSP1.H' }
  12.  
  13. { For MS Pascal $include:'SSSP2.H' }
  14.  
  15. function rnx(m, s: real): real;
  16. var x : real;
  17. begin
  18.   repeat
  19.     x := RN(m, s);
  20.   until x > 0.0;
  21.   rnx := x;
  22. end;
  23.  
  24. procedure prime;
  25. begin
  26.   INIQUE(0,0,1);
  27.   INISTA(1,'Busy fraction',1,0,0,0);
  28.   TALLY(1,FREE);
  29.   SETT(rnx(7, 4));
  30.   TALLY(1,BUSY);
  31. end;
  32.  
  33. begin
  34.   prime;
  35.  
  36.   repeat
  37.     if RA < 0.25 then SETT(T+ER(2,2)) else
  38.                       SETT(T+TR(1,3,4));
  39.     TALLY(1,FREE);
  40.     SETT(T+rnx(7, 4));
  41.     TALLY(1,BUSY);
  42.   until T >= 120;
  43.  
  44.   SUMRY('');
  45. end.
  46.