Random Number
Elaine Jackson
elainejackson7355 at home.com
Sat Mar 27 16:00:18 EST 2004
The probability that the same number will turn up more than once is
approximately one in two million. If you're still worried, you might want to try
something like this:
>>> import random
>>> randoms=[]
>>> while len(randoms)<5:
x=random.randint(1,100)
if x in randoms:
continue
else:
randoms.append(x)
HTH. BTW it's a lot easier to read "10**10" or "1e10" instead of a big string of
zeros.
Peace
"james blair" <talktojamesblair at yahoo.com> wrote in message
news:a4648036.0403271156.787706e5 at posting.google.com...
| Hi
| I am generating a random number using
| random.randint(1,10000000000)
| Whats the possibility that the numbers generated will be same when
| generated by 100 users at the same time?
| Whats the best method to generate random numbers so that they are most
| likely unique??
| Thanks
More information about the Python-list
mailing list