Skip to main content

CombinationsGenerator.generate() method

Generates combinations one at a time using a generator pattern.

Signature

generate(): Generator<MatrixCombination>;

Returns

Generator<MatrixCombination>

Remarks

This method yields combinations one at a time instead of building the entire array in memory. This is particularly useful for large matrices where storing all combinations would be impractical.

Memory efficiency:

  • For a matrix with 10 parameters and 5 values each (9,765,625 combinations), only one combination object exists in memory at a time, regardless of matrix size.
  • No array allocation or storage required.
  • Immediate processing of each combination without waiting for all to be generated.

Example usage:

for (const combo of generator.generate()) {
// Process one combination at a time
await processConfiguration(combo)
}

Yields: Individual matrix combinations one at a time.


Generated via tsdoc2docusaurus 1.3.2 by API Extractor/Documenter 7.57.2.