Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.028 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'example:': 0.03; "subject:' ": 0.07; 'subject:help': 0.08; 'subject:using': 0.09; 'python': 0.11; 'def': 0.12; 'random': 0.14; "'n'": 0.16; 'ah!': 0.16; 'better!!': 0.16; 'dice': 0.16; 'fits': 0.16; 'hmm.': 0.16; 'range.': 0.16; 'received:65.55.116.7': 0.16; 'sense:': 0.16; 'subject: \n ': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'to:name:python-list@python.org': 0.22; 'adds': 0.24; 'received:65.55.116': 0.24; 'sort': 0.25; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'skip:- 40': 0.29; 'leave': 0.29; 'am,': 0.29; 'subject:list': 0.30; 'url:mailman': 0.30; 'question:': 0.31; 'know.': 0.32; 'url:python': 0.33; 'date:': 0.34; 'common': 0.35; 'but': 0.35; 'url:listinfo': 0.36; 'url:org': 0.36; 'list': 0.37; 'email addr:python.org': 0.37; 'depends': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'subject:': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'how': 0.40; 'number,': 0.60; 'times': 0.62; 'email addr:gmail.com': 0.63; 're:': 0.63; 'skip:n 10': 0.64; 'more': 0.64; 'email name:python-list': 0.65; '26,': 0.68; '(any': 0.84; 'all!': 0.84; 'conclude': 0.84; 'operation)': 0.84; 'random,': 0.84; '+1000': 0.91; 'carlos': 0.91; '2013': 0.98 X-TMN: [P2dAc1yDBu7B9Y7RUiF72qzMwrZ/e3sP] X-Originating-Email: [carlosnepomuceno@outlook.com] From: Carlos Nepomuceno To: "python-list@python.org" Subject: RE: help how to sort a list in order of 'n' in python without using inbuilt functions?? Date: Sat, 25 May 2013 20:34:02 +0300 Importance: Normal In-Reply-To: References: , <78192328-b31b-49d9-9cd6-ec742c092a29@googlegroups.com>, , <39ac7437-857e-483f-998c-8162c1039933@googlegroups.com>, <51a052d1$0$6599$c3e8da3$5496439d@news.astraweb.com>, <74e33270-a79a-4878-a400-8a6cda6637b2@googlegroups.com>, , , , , , , , , <51a0ca91$0$30002$c3e8da3$5496439d@news.astraweb.com>, , , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginalArrivalTime: 25 May 2013 17:34:03.0167 (UTC) FILETIME=[0C8572F0:01CE596E] 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: 46 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369503245 news.xs4all.nl 15934 [2001:888:2000:d::a6]:57656 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46015 ----------------------------------------=0A= > Date: Sun=2C 26 May 2013 03:23:44 +1000=0A= > Subject: Re: help how to sort a list in order of 'n' in python without us= ing inbuilt functions??=0A= > From: rosuav@gmail.com=0A= > To: python-list@python.org=0A= >=0A= > On Sun=2C May 26=2C 2013 at 3:17 AM=2C Carlos Nepomuceno=0A= > wrote:=0A= >> def f(x):=0A= >> return x+1=0A= >>=0A= >> or you can just go:=0A= >>=0A= >> f(roll_d6())=0A= >=0A= > Hmm. Interesting. So now we have a question: Does adding 1 to a random=0A= > number make it less random? It adds determinism to the number=3B can a=0A= > number be more deterministic while still no less random?=0A= >=0A= > Ah! I know. The answer comes from common sense:=0A= >=0A= > a =3D random() # a is definitely a random number=0A= > a -=3D random() # a is no longer random=2C we subtracted all the randomne= ss from it=0A= >=0A= > Of course=2C since number-number =3D> number=2C a is still a number. And = so=0A= > we can conclude that adding 1 to a random dice roll does indeed leave=0A= > all the randomness still in it. But wait! That means we can do=0A= > better!!=0A= >=0A= > a =3D random() # a is a random number=0A= > a *=3D 5 # a is clearly five times as random now!=0A= >=0A= > ChrisA=0A= > --=0A= > http://mail.python.org/mailman/listinfo/python-list=0A= =0A= It depends if the result (any operation) is in the required range.=0A= =0A= For example: "int(random.random()+1)" it's not random at all!=0A= =0A= But "int(random.random()*1000)" my look random if it fits your needs.=0A= =0A= =3B) =