Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19952
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.020 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'subject:module': 0.04; 'python)': 0.05; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:python': 0.10; "'a'": 0.16; 'skip:3 30': 0.16; 'subject:between': 0.16; 'subject:random': 0.16; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'rid': 0.29; 'skip:1 30': 0.29; 'seem': 0.29; '(and': 0.30; 'subject:?': 0.31; 'accuracy': 0.32; 'header:User-Agent:1': 0.33; 'header:X-Complaints-To:1': 0.34; '(not': 0.35; 'to:addr:python-list': 0.35; 'something': 0.35; 'received:org': 0.36; '8bit%:86': 0.37; 'acceptable': 0.37; 'but': 0.37; 'skip:_ 10': 0.38; 'to:addr:python.org': 0.40; 'your': 0.61; 'skip:1 10': 0.63; 'results': 0.64; 'skip:\xd0 20': 0.77; 'obtained': 0.80; 'skip:1 20': 0.82; 'received:88.154': 0.84; 'notorious': 0.93 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Serhiy Storchaka <storchaka@gmail.com> |
| Subject | Re: difference between random module in python 2.6 and 3.2? |
| Date | Tue, 07 Feb 2012 12:05:35 +0200 |
| References | <jgna4q$1t08$1@ns.felk.cvut.cz> <4f2f5081$0$29992$c3e8da3$5496439d@news.astraweb.com> <mailman.5464.1328504850.27778.python-list@python.org> <4f2f6b87$0$29992$c3e8da3$5496439d@news.astraweb.com> <mailman.5469.1328513256.27778.python-list@python.org> <4f2f89d7$0$29992$c3e8da3$5496439d@news.astraweb.com> <jgo3pp$269s$1@ns.felk.cvut.cz> <jgo4fg$26h9$1@ns.felk.cvut.cz> <4F302088.8010901@gmail.com> <mailman.5483.1328556387.27778.python-list@python.org> <jgpimq$2ndb$2@ns.felk.cvut.cz> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| X-Gmane-NNTP-Posting-Host | 88.154.238.165 |
| User-Agent | Mozilla/5.0 (X11; Linux i686; rv:10.0) Gecko/20120130 Thunderbird/10.0 |
| In-Reply-To | <jgpimq$2ndb$2@ns.felk.cvut.cz> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5495.1328609155.27778.python-list@python.org> (permalink) |
| Lines | 9 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1328609155 news.xs4all.nl 6962 [2001:888:2000:d::a6]:52532 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:19952 |
Show key headers only | View raw
07.02.12 00:06, Matej Cepl написав(ла):
> return seq[int(random.random() * len(seq))]
>
> doesn't seem like something so terrible (and maintenance intense). :)
_choice('abc') returns 'a' with probability P('a') = 1501199875790165/4503599627370496 = 1/3 - 1/13510798882111488 and 'b' with probability P('b') = 3002399751580331/9007199254740992 = 1/3 + 1/27021597764222976. P('b') - P('a') = 1/9007199254740992.
This may be acceptable for your application, but for applications that are concerned not only about the repeatability of results, but the accuracy and consistency with the results obtained by other (not Python) applications, it is better to get rid of such a notorious bias.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
difference between random module in python 2.6 and 3.2? Matej Cepl <mcepl@redhat.com> - 2012-02-06 02:27 +0100
Re: difference between random module in python 2.6 and 3.2? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-06 04:01 +0000
Re: difference between random module in python 2.6 and 3.2? Terry Reedy <tjreedy@udel.edu> - 2012-02-06 00:07 -0500
Re: difference between random module in python 2.6 and 3.2? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-06 05:56 +0000
Re: difference between random module in python 2.6 and 3.2? Terry Reedy <tjreedy@udel.edu> - 2012-02-06 02:27 -0500
Re: difference between random module in python 2.6 and 3.2? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-06 08:05 +0000
Re: difference between random module in python 2.6 and 3.2? Matej Cepl <mcepl@redhat.com> - 2012-02-06 09:45 +0100
Re: difference between random module in python 2.6 and 3.2? Matej Cepl <mcepl@redhat.com> - 2012-02-06 09:57 +0100
Re: difference between random module in python 2.6 and 3.2? Tim Chase <python.list@tim.thechases.com> - 2012-02-06 13:26 -0600
Re: difference between random module in python 2.6 and 3.2? Matej Cepl <mcepl@redhat.com> - 2012-02-06 23:06 +0100
Re: difference between random module in python 2.6 and 3.2? Serhiy Storchaka <storchaka@gmail.com> - 2012-02-07 12:05 +0200
Re: difference between random module in python 2.6 and 3.2? Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-02-07 16:11 +0100
Re: difference between random module in python 2.6 and 3.2? Mel Wilson <mwilson@the-wire.com> - 2012-02-06 10:20 -0500
csiph-web