the shuffling actually happens in one line of code. I added comments to that line. I also replaced the tabs with spaces.
my editor does that for me, replacing spaces with tabs, but since it's a free editor I'm not going to complain.
anyway here is the updated code.