RandomCombinations

giant.utilities.random_combination:

class giant.utilities.random_combination.RandomCombinations(population, combo_length, number_of_combos)[source]

Iterate over number_of_combos random combinations of combo_length from population.

This iterator ensures unique combinations are returned. If more combinations are requested than are possible then an exhaustive list is returned

Parameters:
  • population (int | Sequence | ndarray) – The population to choose from. If specified as an integer then the population will be range(int).

  • combo_length (int) – The length for each combination as an integer

  • number_of_combos (int) – the number of unique combinations you want as an integer