Function
Static Public Summary | ||
public |
* multicombinations(n: number, r: number): IterableIterator<number[]> Yields all k-multicombinations of {0, 1, ..., n-1}. |
|
public |
multicombinations(iterable: Iterable, r: number): IterableIterator Yields all combinations, with repetitions, of each possible choice of
|
Static Public
public * multicombinations(n: number, r: number): IterableIterator<number[]> source
import multicombinations from '@combinatorics/n-multicombinations/src/_multicombinations.js'
Yields all k-multicombinations of {0, 1, ..., n-1}.
public multicombinations(iterable: Iterable, r: number): IterableIterator source
import multicombinations from '@combinatorics/n-multicombinations/src/multicombinations.js'
Yields all combinations, with repetitions, of each possible choice of
r
elements of the input iterable.
Params:
Name | Type | Attribute | Description |
iterable | Iterable | The input iterable. |
|
r | number | The size of the combinations to generate. |
Return:
IterableIterator |
Example:
// A B C
multicombinations('ABC', 1)
// 00 01 02 11 12 22
multicombinations(range(3), 2)