Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.198 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.67; '*S*': 0.06; 'received:134': 0.05; 'question.': 0.14; 'fruit': 0.16; 'fruit.': 0.16; 'set,': 0.16; '>>>': 0.22; 'example': 0.22; 'header:User-Agent:1': 0.23; 'choices': 0.24; 'regardless': 0.24; 'header:In-Reply-To:1': 0.27; 'appear': 0.29; 'sets': 0.30; "i'm": 0.30; 'sep': 0.31; '+0200,': 0.36; 'acceptable': 0.36; 'should': 0.36; 'jason': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'above,': 0.60; 'kind': 0.63; 'pick': 0.64; 'different': 0.65; 'chance': 0.65; 'talking': 0.65; 'dict()': 0.84; 'pardon': 0.84; 'wanting': 0.93; '2013': 0.98 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4EANpzLVKGuA9G/2dsb2JhbABaxiSBMoMaAQV4EQshFg8JAwIBAgFFEwYCAod+vRGIJJAHFoQHA5d1hhiLToMi Date: Mon, 09 Sep 2013 09:12:05 +0200 From: Antoon Pardon User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Weighted choices References: <522CB887.9090000@rece.vub.ac.be> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1378710734 news.xs4all.nl 15919 [2001:888:2000:d::a6]:60072 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53856 Op 09-09-13 02:21, Dennis Lee Bieber schreef: > On Sun, 08 Sep 2013 19:48:55 +0200, Antoon Pardon > 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