Random Gaussian issues
Question: I'm trying to generate a random.gauss numbers but I have message error. Here
is my code:

    
    
    import sys,os
    import numpy as np
    from random import gauss
    
    
    previous_value1=1018.163072765074389
    previous_value2=0.004264112033664
    
    
    alea_var_n=random.gauss(1,2)
    alea_var_tau=random.gauss(1,2)
    
    
    new_var_n= previous_value1*(1.0+alea_var_n)
    new_var_tau=previous_value2*(1.0+alea_var_tau)
    
    print 'new_var_n',new_var_n
    print 'new_var_tau',new_var_tau
    

I got this error:

    
    
    Traceback (most recent call last):
      File "lolo.py", line 15, in <module>
        alea_var_n=random.gauss(1,2)
    AttributeError: 'builtin_function_or_method' object has no attribute 'gauss'
    

Someone know what's wrong, I'm a newbye with python. Or is it a numpy version
problem.


Answer: For a faster option, see Benjamin Bannier's solution (which I gave a +1 to).
Your present code that you posted will not work for the following reason: your
import statement

    
    
    from random import gauss
    

adds `gauss` to your namespace but not `random`. You need to do this instead:

    
    
    alea_var_n = gauss(1, 2)
    

The error in your post, however, is not the error you should get when you run
the code that you have posted above. Instead, you will get the following
error:

    
    
    NameError: name 'random' is not defined
    

Are you sure you have posted the code that generated that error? Or have you
somehow included the wrong error in your post?

