An analysis of permutations in arrays