Random Number Generation?
mensanator at aol.com
mensanator at aol.com
Sun Dec 11 13:20:57 EST 2005
More information about the Python-list mailing list
Sun Dec 11 13:20:57 EST 2005
- Previous message (by thread): Random Number Generation?
- Next message (by thread): Random Number Generation?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Dimos wrote: > Hello All, > > I need some help with random number generation. What I > need exactly is: > > To create a few thousand numbers, decimal and > integers, between 5 and 90, > and then to export them as a single column at a > spreadsheet. > > I am newbie, I was not able to create decimals with > the random modules of > Python 2.3. You use randint(a,b) to generate an integer between a and b. For real numbers, the function is random(). But that result is always between 0.0 and 1.0, so you have to make the range adjustment yourself. >>> import random >>> for i in range(10): print random.random()*85 + 5 20.2844473176 83.5690712033 77.3459998722 8.79906993754 53.3672450881 25.2609744882 19.8894951301 39.9794852838 43.4056977237 21.7770662903 > > Thanks, Dimos > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com
- Previous message (by thread): Random Number Generation?
- Next message (by thread): Random Number Generation?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list