Hi,
I wrote a random walk program which you will find below.  When I run it from the terminal, it gives error which I am not able to figure out what could be wrong. From the bash shell, I give a command
    >python2.4 random.py
It gives error:
-----------------------------------------------------------------------------------------
    Traceback (most recent call last):
  File "random.py", line 2, in ?
    from pylab import *
  File "/usr/lib/python2.4/site-packages/pylab.py", line 1, in ?
    from matplotlib.pylab import *
  File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 196, in ?
    import mlab  #so I can override hist, psd, etc...
  File "/usr/lib/python2.4/site-packages/matplotlib/mlab.py", line 58, in ?
    import sys, random
  File "/home/ofenerci/workspace/random.py", line 11, in ?
    if (rand() > 0.5):
NameError: name 'rand' is not defined
[3]   Done                    gedit random.py
-------------------------------------------------------------------------------------------------------------
When I  write the program step by step inside the python shell or run it inside the python-idle, everything goes smoothly and it doesn't give any error. I don't know why gives error, If I run it from the terminal.

thanks,
Ahmet Nurlu

Random.py Program:
---------------------------------------------------------------------------
from pylab import *

npts=1000
nplot=10
for i in range(0,nplot):
   
    xplot=[]
    x=0.0
    for i in range(0,npts):
        if (rand() > 0.5):
            x=x+1
        else:
            x=x-1
        xplot.append(x)
    plot(xplot,'g')
    hold(True)
show()
-------------------------------------------------------------------------


Relax. Yahoo! Mail virus scanning helps detect nasty viruses!