Sha256: 4f75e6fd8216731a86889449cc550dda6649b0816aba6ae6024bcdeaa9c17c4c

Contents?: true

Size: 722 Bytes

Versions: 3

Compression:

Stored size: 722 Bytes

Contents

module MonteCarlo
  # Class that contains the result of a single sample of a {MonteCarlo::Experiment}
  class Result
    include Comparable

    # @!attribute value
    #   @return the value returned after the computation
    # @!attribute sample_value
    #   @return the raw value returned from the sample method
    # @!attribute index
    #   @return [Fixnum] the index of the iteration the result was generated at
    attr_accessor :value, :sample_value, :index

    def initialize(index = nil, value = nil, sample_value = nil)
      @value = value
      @sample_value = sample_value
      @index = index
    end

    def <=> other
      self.to_i <=> other.to_i
    end

    def to_i
      @value
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
monte_carlo-0.0.8 lib/monte_carlo/result.rb
monte_carlo-0.0.7 lib/monte_carlo/result.rb
monte_carlo-0.0.6 lib/monte_carlo/result.rb