The Bessie Shuffle

https://ide.usaco.guide/MdY9LEjELsKXC5lyCqg

Basically, you just copy the swapity swapity swap exponentiation code after generating the permutation.