Random key assignment- Psychopy

Description of the problem:
I want to use different set of keys to record responses. I am doing an AMP and want different keys determined randomly by computer to tell the participant to use these keys after the presentation of “mask” for each individual trial.
I am using Psychopy 1.85.2

You want the correct key to be random? That’s a pretty harsh challenge for you participants! :wink:

You would need something like a code component with code like this at the beginning of the routine:

BeginExperiment:

possibleKeys = ['a','b','c']

BeginExperiment:

thisIndex = randint(len(possibleKeys))
thisAns = possiblKeys[thisIndex]

and then insert thisAns into your keyboard component as normal