[Tutor] random numbers

Jay Dorsey python@jaydorsey.com
Wed May 28 13:00:03 2003


On Wednesday 28 May 2003 12:39, Jennifer Cianciolo wrote:
> I'm having trouble generating random numbers.
>
> if I do
>
> import random
> random.random()
>
> I get
>
> TypeError: 'module' object is not callable

What version of Python are you using?  The above code seems to work fine for 
me.  If you want a random integer within a set of numbers, try the following:

>>> import whrandom
>>> whrandom.randrange(1, 10)
4




-- 
Jay Dorsey
python at jay dorsey dot com