Aldwin Pollefeyt <aldwinald...@gmail.com> added the comment:

This is what happens with your weights:

>>> list(itertools.accumulate(weights))
[1, 2, 1, 2, 3, 3, 4]

using bisect.bisect certain amount of times, will distribute on this:
a<1<b<2<c<1<d<2<e<3<f<4<g

random numbers between 1 and 2 will go to 1<'b'<2 and not 'd' that is also 
1<'d'<2

As discussed in issue31689, if no negative weights should be used, then a 
ValueError exception should be re-concidered.

----------
nosy: +aldwinaldwin

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37624>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to