In my Sketch (that I didn’t post, didn’t want to spoil the fun for you) it just produces the 512 permutations without random.
And thanks for explaining what the for loops do. I’ve got some ideas for how to proceed, and this is a fun challenge, so I’ll keep following the path I’m on. If I lose my path though I might cry for help.