PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/tutorial/random/example2.e

http://github.com/tybor/Liberty
Specman e | 31 lines | 27 code | 4 blank | 0 comment | 0 complexity | 41f8d7b046b7a761221db820cf28cf0a MD5 | raw file
 1class EXAMPLE2
 2
 3create {ANY}
 4   main
 5
 6feature {}
 7   main
 8      local
 9         count: INTEGER
10      do
11         io.put_string("Using the PRESS_RANDOM_NUMBER_GENERATOR random number generator.%NHow many numbers? ")
12         io.read_integer
13         count := io.last_integer
14         from
15         until
16            count = 0
17         loop
18            random_generator.next
19            io.put_real(random_generator.last_real)
20            count := count - 1
21            io.put_string("%N")
22         end
23      end
24
25feature {}
26   random_generator: RANDOM_NUMBER_GENERATOR
27      once
28         create {PRESS_RANDOM_NUMBER_GENERATOR} Result.make
29      end
30
31end -- class EXAMPLE2