[solved] Four Random Images Without Replacement
Hi all,
I hope I can explain this task coherently;
My experiment goes like this: Study phase of random faces either once or three times > distractor > test phase
My confusion is in this test phase.
What participants are given is an array of 4 faces. 1 of these faces was shown at study, while the other 3 are new fillers. The arrays as I have them built successfully place the target in a random position and fills the other slots with random fillers.
However, I'm having a problem making it so that fillers are not used more than once or not at all.
In other words, each array must contain 3 random fillers that have never been seen before plus the randomly selected target.
Currently I'm brute forcing this by having a loop in which the target is selected, then four (ugh) nested loops in which one filler is chosen, then another, then another, and then the position is selected.
The target loop runs "x" amount of times for "x" number of trials, while the other three loops run "1/y" amount of times (e.g. .25 times for the position loop)
From my extensive exploration of the forum, I have determined I need some sort of inline code in order to do what I want. As far as I know, I just need to 'pop' out whichever filler has been already used at some point in the trial sequence to prevent it from being selected again.
I am not new to coding, but new to Python, and this solution has eluded me for hours.
Help is very very appreciated, and if more explanation is required, I'll do my best.
Comments
UPDATE: This problem has been solved.
That's brilliant, thanks for letting us know! If you're comfortable with it, we encourage sharing your solution here on the forum (for future reference to other users).