1 | initial version |
One way to randomly combine stimuli from two different loops in OpenSesame is to use Python code.
First, define the two loops and their corresponding variables:
loop1 = items1 # first loop
loop2 = items2 # second loop
n_trials = len(loop1) # number of trials in each loop
Then, use the random
module to randomly select a trial from each loop and concatenate them:
import random
combined_items = [] # list to store combined items
for i in range(n_trials):
item1 = loop1[random.randint(0, n_trials - 1)] # randomly select a trial from loop1
item2 = loop2[random.randint(0, n_trials - 1)] # randomly select a trial from loop2
combined_items.append(item1 + item2) # concatenate the stimuli and add to the list
Finally, create a new loop using the combined_items
list:
combined_loop = [[i] for i in combined_items] # convert the list into format suitable for a loop