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.

classification
Title: Add weighted random choice to random package
Type: Stage:
Components: Library (Lib) Versions: Python 3.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder: allow weights in random.choice
View: 18844
Assigned To: Nosy List: dkorchem, mark.dickinson
Priority: normal Keywords:

Created on 2014-07-23 17:08 by dkorchem, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg223746 - (view) Author: Dmitry Korchemny (dkorchem) Date: 2014-07-23 17:08
Need to have a function for weighted randomization:

given a dictionary: key -> weight (= non-negative number), return a key of the dictionary with the probability proportional to its weight. This capability is basic and is badly missing.
msg223749 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2014-07-23 17:20
Duplicate of #18844.
History
Date User Action Args
2022-04-11 14:58:06adminsetgithub: 66247
2014-07-23 17:20:44mark.dickinsonsetstatus: open -> closed

nosy: + mark.dickinson
messages: + msg223749

superseder: allow weights in random.choice
resolution: duplicate
2014-07-23 17:08:19dkorchemcreate