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


Groups > comp.lang.python > #22163 > unrolled thread

Re: random number

Started byPeter Otten <__peter__@web.de>
First post2012-03-26 09:57 +0200
Last post2012-03-26 09:57 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: random number Peter Otten <__peter__@web.de> - 2012-03-26 09:57 +0200

#22163 — Re: random number

FromPeter Otten <__peter__@web.de>
Date2012-03-26 09:57 +0200
SubjectRe: random number
Message-ID<mailman.983.1332748631.3037.python-list@python.org>
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?

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web