Iza Romanowska added the comment:
Many thanks for patching it!
Much appreciated.
--
___
Python tracker
<https://bugs.python.org/issue38881>
___
___
Python-bug
Iza Romanowska added the comment:
Hi,
Many thanks for engaging with this.
I agree that we should very clearly separate negative weights from zero
weights. A negative number is illegal and that's the end of it. However, a zero
weight is not illegal, e.g., [0, 0, 0, 0.1] is a legal seq
Iza Romanowska 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
New submission from Iza Romanowska :
Hi,
When zero weights are given, the last element of a sequence is always chosen.
Example:
hits= []
for i in range(100):
hits.append(random.choices(["A","B","C","D"], [0, 0, 0, 0])[0])
print (set(hits))
>&g