On Jun 9, 8:39 pm, Paul McGuire <pt...@austin.rr.com> wrote: > Are you trying to generate a number in the > range [0,n] by multiplying a random function that > returns [0,1] * n? If so, then you want to do > this using: int(random.random()*(n+1)) This will > give equal chance of getting any number from 0 to n.
Better still is simply random.randint(0, n) For other discrete random choices, you may find randrange() or choice () useful. John -- http://mail.python.org/mailman/listinfo/python-list