No way to set duration of a stimulus to change every trial

I know this kind of question has been asked many times by others. I want to jitter my ISI (fixation point) from 1.5 to 2.5. I inserted a code before the fixation component, which I think is logically correct. I also typed “$jitter” in the duration field. The “jitter” variable in my data file did record a random value, but that value just didn’t get reset every trial. I know I’m supposed to set the duration to change every repeat, but there is no such an option in the builder.

from numpy.random import random, randint, normal, shuffle
jitter = random() * (2.5 - 1.5) + 1.5
jitter = round(jitter, 1)
thisExp.addData('jitter', jitter)

Can someone help me?

Have you added your code to the “Begin Routine” tab of the code component?

Also, it seems you could simply use random() + 1.5.

Jan