Randomize Between Two Columns

Hello!

I am creating a task where there are two numbers shown on the screen, and participants can press either “F” or “J” on the keyboard to indicate which number is higher.

We would like the two numbers to randomly alternate which side of the screen they appear on (left or right) while remaining with their paired number. I have my trials in an Excel sheet, with the variables linked to my stimuli within the routine. Is there a way to randomize between columns while remaining in the same row in an Excel sheet? I am new to PsychoPy, and Python is also unfamiliar to me.

Any insight would be appreciated!

You could randomise the locations in code:

Begin Experiment

locations = [[-.3,0],[.3,0]]

Begin Routine

shuffle(locations)

Then use locations[0] for the target and locations[1] for the foil.

This works really well for a mouse click because the correct object is always the same.

For a keyboard response you could have

Begin Experiment

locations = [[[-.3,0],'left'],[[.3,0],'right']]

Now the target location is locations[0][0] and the correct answer is locations[0][1]

Thank you for the help @wakecarter !

I put that code into my routine, but the stimuli don’t seem to be adjusting based on the code. Is there something I need to input for each stimuli’s position within the “properties” pop-up? (see below)

Additionally, in the code you provided, what is ‘left’ and ‘right’ indicating?

Thank you in advance!

The position should be locations[0] or locations[0][0] depending on which version of my suggestion you are using. It should be set to update each repeat and the code component should be above it in the routine.

For my code left and right corresponded to the correct answer being the left or right arrow key – the two text elements become target and foil rather than left or right.