After hashing this out a bit with my use case, I’m going to mark this as a solution.
There are a few other caveats:
- Nesting these will result in non-convergence.
- If there are multiple steps or multiple arrays that need to be shuffled/etc, it is possible. It seems the best way is to have a nested function that does all of the randomization necessary step by step. I have one use case that takes two arrays of options, both arrays have to go through suiji #choice, then combined together for a shuffle. Doing those steps all together and keeping the intermittent arrays stored in state works. An alternative is to store a dictionary as the state and reference the keys later post callback.
So, it seems to work. I have yet to modify my project but it looks like it will work out. This does make for a different structure/approach for code (i.e. you basically have to make the randomization the last thing and so everything else should be done first).