[solved] Why am I getting repeats?
Ok this is driving me mad, I have commented most of it out to try and eliminate mistakes but my final list always gets some repeats and some omissions. Desperate for an answer.
import random
picList = ["achievement.jpg", "admired.jpg", "alert.jpg", "cope.jpg", "energy.jpg",
"friendships.jpg","good_decision.jpg", "good_news.jpg", "good_times.jpg", "healthy.jpg",
"hope.jpg", "liked.jpg", "praised.jpg", "problem_solve.jpg", "success.jpg"]
random.shuffle(picList)
cue = picList
pic= cue[0]
exp.set("pic", pic)
This discussion has been closed.
Comments
Hi,
The short answer could be a bit frustrating, but is very clear: You should not be having any repeats in the picList after shuffling it. There could be repeats, however, if there is more processing being done on the list later on!
Another possibility is that you have defined a custom random library, where the shuffle function does produce repeats (but this is something you would probably know, and is quite unlikely).
Best,
Edwin
Closing as duplicate of #1064.
@ghostrider Please don't post the same question multiple times!
Check out SigmundAI.eu for our OpenSesame AI assistant!