Class: HugeCombination

Inherits:
HugeCollection show all
Defined in:
lib/huge_enumerable/huge_combination.rb

Overview

combination[size / 2] # => “292893218813452475599155637895 + 296085173605458049080913472356 = 588978392418910524680069110251”

Constant Summary

Constants inherited from HugeEnumerable

HugeEnumerable::DEFAULT_MAX_ARRAY_SIZE, HugeEnumerable::VERSION

Instance Attribute Summary

Attributes inherited from HugeEnumerable

#max_array_size, #rng

Instance Method Summary collapse

Methods inherited from HugeEnumerable

#[], #collection_each, #combination, #each, #empty?, #initialize_copy, #next_array, #permutation, #pop, #product, #sample, #shift, #shuffle, #shuffle!, #size

Constructor Details

#initialize(enumerable, size, max_array_size = nil, rng = nil) ⇒ HugeCombination

Create a new HugeCombination

Attributes

  • enumerable - Any enumerable that responds to []

  • size - The number of elements per combination to use from enumerable.

Options

  • :max_array_size - The default size of arrays when #to_a is called.

  • :rng - The random number generator to use.



67
68
69
70
# File 'lib/huge_enumerable/huge_combination.rb', line 67

def initialize(enumerable, size, max_array_size = nil, rng = nil)
  @combination_size = size
  super(enumerable, max_array_size, rng)
end