I have a running experiment where two stimuli are presented on the left and right side of the screen. The following code does this and it works fine. The stimuli are in an excel sheet contains the target and distractor image paths.
if random() < 0.5:
targetPos = [-0.5,0]
otherPos = [0.5,0]
corrAns = ‘a’
targetPos = [0.5,0]
otherPos = [-0.5,0]
corrAns = ‘l’
My supervisors told me that it’s better to have PsychoPy randomly choose a target so that the two images are not always chosen together. He said this can be done by generating a random number from 1 to 10 to create a long stimulus name.
I am new to coding so I’m not sure how this should go but I am thinking:
#get random number from 1 to 10
for x in range(10):
Then to make the string would you use %s? and then use %x ? Also, once the string is generated, what would I have to change for PsychoPy to use this code?