I have a for loop that I would like to loop through in every unique ordering.
For example if I want to loop through the set of numbers = [1,2,3] I can loop through these numbers in the order of 1 -> 2 - > 3, but I could also do 3->2->1. I would like to loop through my set of numbers in every possible unique ordering.
I want to get this output
i = 1,2,3
i = 1,3,2
i = 2,1,3
i = 2,3,1
i = 3,1,2
i = 3,2,1
So ideally it would be two for loops. The outer loop would change the ordering of the numbers and the inner loop would iterate through the numbers. I'm having a hard time thinking of a way to do this. Is there any straightforward means that might accomplish this?
Thanks!