Randomisation

Every now and then, you will have an experiment with various images or various text that will be presented to the participants. In some cases it is better to randomise the images and text, so that the order of the images or text doesn't bias the participant's decision-making or reactions within the experiment. For example, in an experiment where emotions are being rated, if all participants received the images in the same order, someone might criticise your experiment and say that this is the reason for the participant's true ratings. They could claim the a specific image in the start biased the participant's to be sad throughout the whole experiment, and they therefor voted more negatively. However, if the images were randomised then no one could make this claim about your experiment.

Before randomisation can work, you must import the module for randomising. This module is called random, and is imported alone - not from psychopy.

from psychopy import visual, event
import random

To randomise the images or text in your experiment, simply use the random.shuffle() function on the variable containing your images or text. In the following I have created a variable called 'images' where I retrieve my images from the folder they are located in. Then I use the random.shuffle() function on them:


images = glob.glob(path + "*.jpg")

random.shuffle(images)

results matching ""

    No results matching ""