permutation for arrays