Class: Fortune::C_repetition
- Inherits:
-
P_abstract
- Object
- P_abstract
- Fortune::C_repetition
- Defined in:
- lib/fortune/c_repetition.rb
Overview
Combination with repetition
Instance Attribute Summary
Attributes inherited from P_abstract
Instance Method Summary collapse
-
#initialize(h) ⇒ C_repetition
constructor
A new instance of C_repetition.
Methods inherited from P_abstract
Constructor Details
#initialize(h) ⇒ C_repetition
Returns a new instance of C_repetition.
5 6 7 8 |
# File 'lib/fortune/c_repetition.rb', line 5 def initialize(h) super(h) self.value = Math.factorial(self.n + self.k - 1)/(Math.factorial(self.k)*Math.factorial(self.n - 1)) end |