Code that makes sure the stimuli do not appear too close to each other

Hey everyone,

I am using the builder to create a spatial n-back task in which the same stimulus will appear back to back number of times in different positions and a question will be asked. I am trying to make sure that the current stimulus does not appear too close to the previous one. Any idea how I should write a code for this? I am currently randomly getting x, and y coordinates with random.choice.

Thanks in advance.

Hello gamze

here you see one way how to randomize two positions

Alternatively, you could create a lis tof x- and y-positions at the beginning of the experiment, randomize those and pick from the list.

Best wishes Jens

Thank you for your reply and for your time Jens. I was more looking for examples for creating stimuli that do not appear too close to each other instead of randomly picking the positions from a list. However, I created a code for that and it worked. Thanks again :slight_smile: