Customize builder randomization to be pseudo random in code component

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): I use macOS Big Sur Version 11.6
PsychoPy version (e.g. 1.84.x): version 2021.1.3

Hi all I am stuck, I use builder to create stroop task changing color between green and red. I need to modify the loop to be pseudo random, so the same color will not be repeated mpre than 4 time.

I am figuring out, if I want to update the randomization variable related loop, in code component, I think I need to link the code builder setting with my modification code. some times I tried it but it was still not connected well, the random still from the builder setting and ignore my code in custom code. I am figuring out how to connect the builder setting randomization with code component, in which dialogue box component I need to write, I guess it will be in each frame. but yeah my problem the code component still be ignored by the system…
any solution would be really appreciated.

What have you been trying to do so far? Can you show us the code?