Class: NormaleDistribution::Persistant

Inherits:
Object
  • Object
show all
Defined in:
lib/normale_distribution/persistant.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(standard_deviation: 1.0, esperance: 0.0) ⇒ Persistant

Returns a new instance of Persistant.

Raises:

  • (ArgumentError)


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

#esperanceObject

Returns the value of attribute esperance.



3
4
5
# File 'lib/normale_distribution/persistant.rb', line 3

def esperance
  @esperance
end

#standard_deviationObject

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