I want to generate random result with weights based on the previous result.
I am generating random results with weights in the following manner
a = [1, 2, 3, 4, 5, 6]
results = random.choices(a, weights=(
(10, 20, 30, 30, 10, 6)), k=100)
print (results[0:100]
What I want to do is if results[n] = 1, the next result cannot be 6(i.e. it can be between 1 and 5). I am new to this page and python. Any help would be useful
Aucun commentaire:
Enregistrer un commentaire