Using the Random Module.

WDC ki4yjl at gmail.com
Fri Jul 11 18:59:03 CEST 2008


I am currently learning, and loving, Python and have a question about
random().

Right now, what I have to do to get a whole number and not a decimal
using random.random() is this:

>>>random.random()
0.84765728501856734
>>>_ * 10**17
84765728501856734.0

Is there a better way to do that besides doing this:

>>>random.randint(00000000000000000, 99999999999999999)
09657398671238769

Thanks for your time.

David



More information about the Python-list mailing list