good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^4: Randomly choosing from a set of alternatives with varying popularityby LanX (Saint) |
on Mar 28, 2022 at 10:16 UTC ( [id://11142459]=note: print w/replies, xml ) | Need Help?? |
> I'm curious to know how my other objection is handled. The order in a Perl hash is random, but fixed during a run. So this algorithm will be biased to some results. OK, after a second coffee I finally got my had wrapped around it. Definition/Interpretation matters: The random pick $r between from 0..N-1 represents what the voter $r has chosen. Hence order doesn't matter as long as it is fixed, since a 100 wide interval will always have the same probability of 100/550, no matter where it occurs.˛ But I don't see any intuitive way to invert this interpretation, because $r has not-voted to all other choices. Assigning "inverted" votes like suggested in your other post might work, as long as they sum up to 550 again°. But the question of the weighting factor and distribution will come up again.
Cheers Rolf °) respectively N' is corrected.
update˛) IOW no matter if voters John and Jim swapped their place, their probability to be chosen stays the same.
In Section
Seekers of Perl Wisdom
|
|