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


Groups > comp.lang.python > #53856

Re: Weighted choices

Date 2013-09-09 09:12 +0200
From Antoon Pardon <antoon.pardon@rece.vub.ac.be>
Subject Re: Weighted choices
References <CANy1k1gHFFgd82P5VZJEEZvWe_kHJvi2r1uqVh3Sr=nFZyazuQ@mail.gmail.com> <522CB887.9090000@rece.vub.ac.be> <kl4q29ta0kn2tnfoju13dg8nni4vjvco80@4ax.com>
Newsgroups comp.lang.python
Message-ID <mailman.164.1378710734.5461.python-list@python.org> (permalink)

Show all headers | View raw


Op 09-09-13 02:21, Dennis Lee Bieber schreef:
> On Sun, 08 Sep 2013 19:48:55 +0200, Antoon Pardon
> <antoon.pardon@rece.vub.ac.be> declaimed the following:
> 
>> 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?
> 
> 	If we are talking probabilities, regardless of what the weighting is,
> it should be probable (if unlikely) to get three-of-a-kind.

Why should that be? I'm unfamiliar with any kind of imperative that
discourages people from wanting sets with three different kinds of
fruit.

-- 
Antoon Pardon

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: Weighted choices Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-09 09:12 +0200
  Re: Weighted choices Steven D'Aprano <steve@pearwood.info> - 2013-09-09 09:11 +0000
    Re: Weighted choices Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-09 12:01 +0200

csiph-web