Author ariddell
Recipients ariddell
Date 2017-10-04.12:53:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1507121599.13.0.213398074469.issue31689@psf.upfronthosting.co.za>
In-reply-to
Content
Code to reproduce problem:

population = list(range(10))
weights = list(-1 * w for w in range(10))
[random.choices(population, weights) for _ in range(1000)]

will raise IndexError:

    358         bisect = _bisect.bisect
    359         total = cum_weights[-1]
--> 360         return [population[bisect(cum_weights, random() * total)] for i in range(k)]
    361 
    362 ## -------------------- real-valued distributions  -------------------

IndexError: list index out of range
History
Date User Action Args
2017-10-04 12:53:19ariddellsetrecipients: + ariddell
2017-10-04 12:53:19ariddellsetmessageid: <1507121599.13.0.213398074469.issue31689@psf.upfronthosting.co.za>
2017-10-04 12:53:19ariddelllinkissue31689 messages
2017-10-04 12:53:18ariddellcreate