Could this be the issue you’re experiencing? Hard to tell from the snippet how the entire thing operates but I’d blame getting inconsistent result from random (the irony, eh?!) on the evaluation logic.
In short: if you’re running a loop asking for a random bool, you will get a random one with each iteration, not with each loop.