Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #53848 > unrolled thread

Re: Weighted choices

Started byAntoon Pardon <antoon.pardon@rece.vub.ac.be>
First post2013-09-08 19:48 +0200
Last post2013-09-08 19:48 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Weighted choices Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-08 19:48 +0200

#53848 — Re: Weighted choices

FromAntoon Pardon <antoon.pardon@rece.vub.ac.be>
Date2013-09-08 19:48 +0200
SubjectRe: Weighted choices
Message-ID<mailman.157.1378665333.5461.python-list@python.org>
Op 08-09-13 04:12, Jason Friedman schreef:
> choices = dict()
> choices["apple"] = 10
> choices["pear"] = 20
> choices["banana"] = 15
> choices["orange"] = 25
> choices["kiwi"] = 30
>
> I want to pick sets of fruit, three in a set, where the chance of
> selecting a given fruit is proportional to its weight.  In the example
> above, pears should appear twice as often as apples and kiwis should
> appear twice as often as bananas.

Just a small question. Is a set of three bananas an acceptable outcome?

-- 
Antoon Pardon

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web