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.

Raises:

  • (ArgumentError)


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

#nextObject



46
47
48
# File 'lib/erv/random_variable.rb', line 46

def next
  @most_recent += @var.next
end