Iterators.CombinationsWithReplacement(Int32, Int32, Int32[]) Method

Enumerates the indexes of all combinations with replacement of the specified length from a set of the specified size.

Definition

Namespace: Extreme.Mathematics
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
C#
public static IEnumerable<int[]> CombinationsWithReplacement(
	int count,
	int length,
	int[] result
)

Parameters

count  Int32
The size of the set to draw combinations from.
length  Int32
The length of the combinations.
result  Int32[]
An array that is to hold the result.

Return Value

IEnumerable<Int32[]>
A sequence of integer arrays that contain the indexes of all combinations with replacement of length elements from a set of size count.

Remarks

The indexes are returned each time in the same array, result. Its elements should not be modified. If they are modified, the results are unpredictable.

Exceptions

ArgumentOutOfRangeException

length is less than zero.

See Also