This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.moore
Recipients mark.dickinson, paul.moore, rhettinger, steven.daprano
Date 2018-05-14.11:54:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1526298872.91.0.682650639539.issue33494@psf.upfronthosting.co.za>
In-reply-to
Content
Supplying cum_weights allows the code to use bisection to locate the correct value to return. This is O(log n), and is significantly faster for large populations than supplying weights (which need to be totalled for the calculation).

Requiring a pre-check on cum_weights (for example, the obvious check that the sequence is nondecreasing) would add an O(n) step, and so significantly impact performance for that case.
History
Date User Action Args
2018-05-14 11:54:32paul.mooresetrecipients: + paul.moore, rhettinger, mark.dickinson, steven.daprano
2018-05-14 11:54:32paul.mooresetmessageid: <1526298872.91.0.682650639539.issue33494@psf.upfronthosting.co.za>
2018-05-14 11:54:32paul.moorelinkissue33494 messages
2018-05-14 11:54:32paul.moorecreate