Class: ERV::SequentialRandomVariable

Inherits:
Object
  • Object
show all
Defined in:
lib/erv/random_variable.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ SequentialRandomVariable

Returns a new instance of SequentialRandomVariable.



33
34
35
36
37
# File 'lib/erv/random_variable.rb', line 33

def initialize(args)
  first = args[:first_value]
  @most_recent = first.nil? ? 0.0 : first
  @var = RandomVariable.new(args.reject{|k,v| k == :first_value })
end

Instance Method Details

#nextObject



39
40
41
# File 'lib/erv/random_variable.rb', line 39

def next
  @most_recent += @var.next
end