Class: Rust::UniformRandomVariable

Inherits:
RandomVariable show all
Defined in:
lib/rust/stats/probabilities.rb

Overview

Represents a uniform random variable.

Constant Summary

Constants inherited from RandomVariable

RandomVariable::EPSILON

Instance Attribute Summary

Attributes inherited from RandomVariable

#values

Instance Method Summary collapse

Methods inherited from RandomVariable

#*, #+, #approx!, complete, #exact!, #extract, #mul, #probability, #rep

Methods inherited from RandomVariableSlice

#<, #<=, #==, #>, #>=, #between, #expected, #ml, #probability, #so_that

Constructor Details

#initialize(values, exact = false) ⇒ UniformRandomVariable

Creates random variables for which all the values have the same probability (1 / values.size).



285
286
287
# File 'lib/rust/stats/probabilities.rb', line 285

def initialize(values, exact = false)
    super(values.map { |k| [k, 1.0 / values.size]}.to_h, exact)
end