Class: Fortune::C_repetition

Inherits:
P_abstract show all
Defined in:
lib/fortune/c_repetition.rb

Overview

Combination with repetition

Instance Attribute Summary

Attributes inherited from P_abstract

#k, #n, #value

Instance Method Summary collapse

Methods inherited from P_abstract

calc

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