Function Reference


Returns an array of the Permutations of all Elements in a 1D array

#include <Array.au3>
_ArrayPermute ( ByRef $aArray [, $sDelimiter = ""] )


$aArray The Array to get Permutations
$sDelimiter [optional] String result separator, default is "" for none

Return Value

Success: an array of Permutations.
$aArray[0] contains the number of strings returned.
The remaining elements ($aArray[1], $aArray[2] ... $aArray[n]) contain the Permutations.
Failure: sets the @error flag to non-zero.
@error: 1 - The Input Must be an Array
2 - $aArray is not a 1 dimensional array


The input array must be 0-based, i.e. no counter in $aArray[0].
Based on the algorithm by Alexander Bogomolny (




; Declare a 1-dimensional array, return an Array of permutations

#include <Array.au3>

Local $aArray[4] = [1, 2, 3, 4]
Local $aNewArray = _ArrayPermute($aArray, ",") ;Using Default Parameters
_ArrayDisplay($aNewArray, "Array Permuted")