Randomly choose text without replacement

Hi, I want to randomly choose the response the participants previously made to make a RJT text in my experiement. However, I find that I cannot use the random function in the psychopy. I am wondering if anyone have any idea about how to achieve this goal? I would be very appreciative of your time and concern!


Hi @Gina_Wang,

usually it should work like this:

import random

list = ["a", "b", "c"]

sample = random.choice(list) 

What exactly does not work fo you?

Hi, Thank you so much for your reply! It shows from my end that I cannot import any package in the psychopy. I don’t know what is the reason causing this issues.

Ok, this sounds like a more fundamental problem. What error do you get when you try to import a package?

I would tend to use:

list = ["a", "b", "c"]

sample = list.pop()

since this will assign a random value from the list, but also remove it so it can’t be picked again.


Thank you!