SHOW:
|
|
- or go back to the newest paste.
| 1 | class RandomSequence | |
| 2 | def initialize(limit,num) | |
| 3 | @limit,@num = limit,num | |
| 4 | end | |
| 5 | def each | |
| 6 | @num.times { yield (rand * @limit).floor }
| |
| 7 | end | |
| 8 | end | |
| 9 | ||
| 10 | - | n = RandomSequence.new(10,4) |
| 10 | + | i = -1 |
| 11 | RandomSequence.new(10,4).each do |num| | |
| 12 | i = num if i < num | |
| 13 | end |