psychopy.org | Reference | Downloads | Github

Change stimuli location every n trials

Currently, I have it so that a random location within bounds is chosen at the beginning of the experiment:

tlower_bound_x = (- 0.075);
tupper_bound_x = 0.075;
tlower_bound_y = 0.25;
tupper_bound_y = 0.35;

target_x = ((Math.random() * (tupper_bound_x - tlower_bound_x)) + tlower_bound_x);
target_y = ((Math.random() * (tupper_bound_y - tlower_bound_y)) + tlower_bound_y);

However, now, I’d like it so that this location changes every n trials. Thoughts on how to approach this?

trialIdx +=1
if trialIdx == n:
Do stuff
trialIdx = 0