Iterators.Permutations(Int32, Int32, Boolean) Method

Enumerates the indexes of all permutations 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[]> Permutations(
	int count,
	int length,
	bool lexicographic
)

Parameters

count  Int32
The size of the set to draw permutations from.
length  Int32
The length of each permutation.
lexicographic  Boolean
Specifies whether the permutations should be returned in lexicographic order.

Return Value

IEnumerable<Int32[]>
A sequence of integer arrays that contain the indexes of all permutations from a set of size count. If lexicographic is true, then the permutations are returned in lexicographic order.

Remarks

When lexicographic order is not required, it is faster to set lexicographic to false.

See Also