generated from tc39/template-for-proposals
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weighted sampling #6
Comments
Open
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Python
random.choices()
function defaults to selecting an item uniformly from the collection, but optionally lets you specify a list (of the same size) of weights to make a weighted sample instead. I suspect that'll be fairly useful.(It also lets you instead specify your weights as cumulative weights; I dunno if we really need to support both. Converting one to the other is trivial.)
The text was updated successfully, but these errors were encountered: