Sorting code and permutation Generators