home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_show / lib_rand / demo1.e next >
Text File  |  1999-06-05  |  2KB  |  56 lines

  1. -- This file is  free  software, which  comes  along  with  SmallEiffel. This
  2. -- software  is  distributed  in the hope that it will be useful, but WITHOUT
  3. -- ANY  WARRANTY;  without  even  the  implied warranty of MERCHANTABILITY or
  4. -- FITNESS  FOR A PARTICULAR PURPOSE. You can modify it as you want, provided
  5. -- this header is kept unaltered, and a notification of the changes is added.
  6. -- You  are  allowed  to  redistribute  it and sell it, alone or as a part of
  7. -- another product.
  8. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  9. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr
  10. --                       http://SmallEiffel.loria.fr
  11. --
  12. class DEMO1
  13.  
  14. creation make
  15.  
  16. feature
  17.  
  18.    make is
  19.       local
  20.          count, range, column: INTEGER;
  21.       do
  22.          io.put_string("Using the MIN_STAND random number generator.%N%
  23.                        %How many numbers ? ");
  24.          io.read_integer;
  25.          count := io.last_integer;
  26.          io.put_string("Range ( > 1)     ? ");
  27.          io.read_integer;
  28.          range := io.last_integer;
  29.          from
  30.          until
  31.             count = 0
  32.          loop
  33.             random_generator.next;
  34.             io.put_integer(random_generator.last_integer(range));
  35.             count := count - 1;
  36.             if column = 6 then
  37.                io.put_string("%N");
  38.                column := 0;
  39.             else
  40.                column := column + 1;
  41.                io.put_string("%T");
  42.             end;
  43.          end;
  44.          io.put_string("%N");
  45.       end;
  46.  
  47. feature {NONE}
  48.  
  49.    random_generator: MIN_STAND is
  50.       once
  51.          !!Result.make;
  52.       end;
  53.  
  54. end -- DEMO1
  55.  
  56.