Question about how to make a fixation cross appear for various durations

Don’t do that. There is a far better alternative:

For a simple task like this, you could actually just embed a random function as @schubisu suggests , directly in the onset field of your stimulus, with a $ prefix to indicate that it is code. But you will probably also want to save that value in the data, which requires another line of code. So insert a code component, put it above the text stimulus so that it updates the variable before the text stimulus needs to refer to it, and put in something like this in the Begin Routine tab:

fixation_start_time = np.random.choice([0.5, 1.0, 2.0])
thisExp.addData('fixation_start_time', fixation_start_time)

and then put $fixation_start_time in the stimulus onset field, set to update every routine.

1 Like