This question already has an answer here:
- A weighted version of random.choice 18 answers
I want to make a program of AI with Thompson sampling. anyway lets say I have an array of functions [do1, do2, do3] and an array of probability: [prob1, prob2, prob3] (prob1 + prob2 + prob3 = 1) how do I it so I run a function that will pick randomly a function with different odds? (so if we run the program say 100000000 times so about prob1*100% of the time it will run do1) Thanks a lot!
Aucun commentaire:
Enregistrer un commentaire