MATLAB: How to ensure equal probability of stim appearing on L or R of screen without hard-coding? Description inside.

psychtoolbox

Hi,
I am working on a task in Psychtoolbox where I'd like to display a stimulus 50% of the time on the left side of the screen, and 50% on the right side. Is there a way to ensure an equal balance of where the stimulus will appear without hard-coding? I would like it to be random (but always balanced) each time I run the task, but am not sure how to set this up. Thanks!

Best Answer

50% turns out to be surprisingly tricky
Related Question