Path: csiph.com!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!xlned.com!feeder7.xlned.com!news2.euro.net!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.018 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'string.': 0.05; 'from:addr:web.de': 0.09; 'subject:number': 0.09; 'clear.': 0.16; 'received:80.91': 0.16; 'received:80.91.229': 0.16; 'received:dip.t-dialin.net': 0.16; 'received:gmane.org': 0.16; 'received:list': 0.16; 'received:t-dialin.net': 0.16; 'subject:random': 0.16; 'argument': 0.18; 'output': 0.18; 'string': 0.18; 'def': 0.20; 'wrote:': 0.21; 'passing': 0.22; 'header:User-Agent:1': 0.23; 'input': 0.24; 'tried': 0.26; 'question': 0.30; 'normally': 0.33; 'could': 0.34; 'should': 0.35; 'header:X-Complaints-To:1': 0.36; 'some': 0.37; 'something': 0.38; 'called': 0.38; 'received:org': 0.38; 'base': 0.39; 'to:addr :python-list': 0.39; 'how': 0.40; 'to:addr:python.org': 0.40; 'your': 0.60; 'more': 0.63; 'achieve': 0.64; 'information,': 0.65; '(though': 0.84; 'results,': 0.84; 'alphanumeric': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: random number Date: Mon, 26 Mar 2012 09:57:39 +0200 Organization: None References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p5084a42d.dip.t-dialin.net User-Agent: KNode/4.7.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 1332748631 news.xs4all.nl 6972 [2001:888:2000:d::a6]:54626 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:22163 Nikhil Verma wrote: > I want something to achieve like this :- > > def random_number(id): # I am passing it from request > # do something > return random_number > > Output > > random_number(5) > AXR670 That's normally not called a number (though it could be base 36 or similar). > One input that is a number in return you are getting 6 digit alphanumeric > string. > > I tried this > s = '%06d' % random.randint(0, 999999) > > it gives : '192862' (a string ) Your question is not very clear. Can you give some more information, what you want to do with your "random" "number", and how the id argument should influence possible results, e. g. can the possible outcomes of random_number(x) and random_number(y) overlap for x != y?