Class: ERV::SequentialRandomVariable
- Defined in:
- lib/erv/random_variable.rb
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ SequentialRandomVariable
constructor
A new instance of SequentialRandomVariable.
- #next ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ SequentialRandomVariable
Returns a new instance of SequentialRandomVariable.
39 40 41 42 43 44 |
# File 'lib/erv/random_variable.rb', line 39 def initialize(args={}) first = args.delete(:first_value) raise ArgumentError, "First value must be provided!" if first.nil? @most_recent = first.to_f @var = RandomVariable.new(args) end |
Instance Method Details
#next ⇒ Object
46 47 48 |
# File 'lib/erv/random_variable.rb', line 46 def next @most_recent += @var.next end |