generate_permutations function

Generate batch permutations