|
CombinatoricsPermutationsT Method
|
Enumerates all possible value permutations for a given array.
Namespace:
Accord.Math
Assembly:
Accord.Math (in Accord.Math.dll) Version: 3.8.0
Syntax public static IEnumerable<T[]> Permutations<T>(
T[] values,
bool inPlace = false
)
Public Shared Function Permutations(Of T) (
values As T(),
Optional inPlace As Boolean = false
) As IEnumerable(Of T())
Request Example
View SourceParameters
- values
- Type: T
The array whose permutations need to be generated - inPlace (Optional)
- Type: SystemBoolean
If set to true, the different generated permutations will be stored in
the same array, thus preserving memory. However, this may prevent the
samples from being stored in other locations without having to clone
them. If set to false, a new memory block will be allocated for each
new object in the sequence.
Type Parameters
- T
Return Value
Type:
IEnumerableTExamples
int[] values = { 1, 2, 3 };
foreach (int[] permutation in Combinatorics.Permutations(values))
{
}
See Also