different way to generate permutation