I'm pretty new to coding and I haven't been able to find an answer to the question above. Here is what I have:
def sigma():
numberlist = [0.5, 0.2, 0.14, 0.07]
sigmanew = randomchoices(numberlist, weights=(5, 15, 30, 50), k=1)
return sigmanew
I want to set the value of sigma to something new each time I run the code based on these weights, but this doesn't seem to work. I know I can do random.uniform to call within this range, but the fact that the values are weighted is important. How can I accomplish this?
Aucun commentaire:
Enregistrer un commentaire