Class: NormaleDistribution::Persistant
- Inherits:
-
Object
- Object
- NormaleDistribution::Persistant
- Defined in:
- lib/normale_distribution/persistant.rb
Instance Attribute Summary collapse
-
#esperance ⇒ Object
Returns the value of attribute esperance.
-
#standard_deviation ⇒ Object
Returns the value of attribute standard_deviation.
Instance Method Summary collapse
- #between(a, b) ⇒ Object
- #greater_than(a) ⇒ Object
-
#initialize(standard_deviation: 1.0, esperance: 0.0) ⇒ Persistant
constructor
A new instance of Persistant.
- #less_than(a) ⇒ Object
Constructor Details
#initialize(standard_deviation: 1.0, esperance: 0.0) ⇒ Persistant
Returns a new instance of Persistant.
4 5 6 7 8 |
# File 'lib/normale_distribution/persistant.rb', line 4 def initialize standard_deviation: 1.0, esperance: 0.0 @standard_deviation = Float(standard_deviation) @esperance = Float(esperance) raise ArgumentError, "standard_deviation must be > 0" unless @standard_deviation > 0.0 end |
Instance Attribute Details
#esperance ⇒ Object
Returns the value of attribute esperance.
3 4 5 |
# File 'lib/normale_distribution/persistant.rb', line 3 def esperance @esperance end |
#standard_deviation ⇒ Object
Returns the value of attribute standard_deviation.
3 4 5 |
# File 'lib/normale_distribution/persistant.rb', line 3 def standard_deviation @standard_deviation end |
Instance Method Details
#between(a, b) ⇒ Object
18 19 20 |
# File 'lib/normale_distribution/persistant.rb', line 18 def between a, b repartition(b) - repartition(a) end |
#greater_than(a) ⇒ Object
10 11 12 |
# File 'lib/normale_distribution/persistant.rb', line 10 def greater_than a 1 - repartition(a) end |
#less_than(a) ⇒ Object
14 15 16 |
# File 'lib/normale_distribution/persistant.rb', line 14 def less_than a repartition a end |