Module: Prubybility::Combinations

Extended by:
Fiddle::Importer
Included in:
NegativeBinomial
Defined in:
lib/prubybility/combinations.rb

Overview

This module provides a way to calculate combinations to be used by the probability distributions defined in this gem.

Please note, it is not intended to be used outside of this context and may return unexpected answers if used in such manner.

Class Method Summary collapse

Class Method Details

.choose(x, y) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/prubybility/combinations.rb', line 18

def self.choose(x, y)
  return unless valid_input?(x, y)

  ptr = binom(x, y)
  int = ptr.to_s.to_i
  free_binom(ptr)
  int
end