Iza Romanowska <izaromanow...@gmail.com> added the comment:
Dear Raymond, I understand that passing all zero weights may look nonsensical but random.choices is an implementation of the roulette wheel which is widely used across different scientific disciplines and the situation of passing all zeros is completely plausible. In genetics: A genome may consist of a set of genes none of which increases fitness thus their relative probability of being copied over other genes is all zero. In political sciences or cultural evolution: A voter may hate all parties (ie. their individual preference for any one party is zero). An agent may happen to have no preference for either of the options. In engineering: All solutions may carry zero increase in performance. You are absolutely right that negative weights make no sense (how can you choose option A with a -10% chance. But a 0% chance is entirely possible. I consulted with colleagues working in other languages and it looks that the default for roulette wheel with zero weights is choosing at random. This should probably be consulted with a mathematician who knows the definition of the algorithm. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38881> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com