Class: Rust::UniformRandomVariable
- Inherits:
-
RandomVariable
- Object
- RandomVariableSlice
- RandomVariable
- Rust::UniformRandomVariable
- Defined in:
- lib/rust/stats/probabilities.rb
Overview
Represents a uniform random variable.
Constant Summary
Constants inherited from RandomVariable
Instance Attribute Summary
Attributes inherited from RandomVariable
Instance Method Summary collapse
-
#initialize(values, exact = false) ⇒ UniformRandomVariable
constructor
Creates random variables for which all the
values
have the same probability (1 / values.size).
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 |