vendredi 2 octobre 2015

python weighted random with unique key [on hold]

I want to pick A, B or C by given weights.

Let's say:

A has 0.2 weight 
B has 0.2 weight 
C has 0.6 weight

However, If key1 picks A at first run, I want it to keep A for key1 all the time.

And I have unique key for all entries say:

key1: xxxxx-00000-zzzz
key2: zzzzz-00000-yyyy

Each key is unique with no duplicate.

Is there a way to pick with weights but same pick all the time given some unique key?




Aucun commentaire:

Enregistrer un commentaire