[Tutor] random numbers

Jennifer Cianciolo jciancio@indiana.edu
Wed May 28 14:03:01 2003


Ok, I did have a file named random.py.  I guess that's not a good
idea!!  I deleted it, but the random.random() is still not working.

import whrandom
whrandom.randrange(1, 10)

does work!!  but then someone said not to use that :(
so I'm still confused.

also thanks to all on clarifying pseudorandom!

-------------------
> 
> 
> On Wed, 28 May 2003, 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
> 
> 
> Hello!
> 
> 
> Hmmm... we seem to be getting a whole slew of module importing
questions
> today...  *grin* I think we need more information; it sounds like
the
> 'random' that you're importing isn't the one from the Standard
Library.
> 
> 
> 
> Let's probe this: what's the name of your current source file?  Is
it
> called 'random.py', or is there a 'random.py' in your current
directory?
> If so, that's most likely the source of our problem.  If not, then
we'll
> have to think of something else.
> 
> 
> By the way, I've actually cooked up a small pseudomodule that tries
to
> alleviate a common module importing problem:
> 
>     http://hkn.eecs.berkeley.edu/~dyoo/python/__std__/
> 
> 
> 
> 
> Good luck to you!
> 
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 
> 
>