[SciPy-user] looking for Monte Carlo Method for generating normal distribition

Robert Kern robert.kern at gmail.com
Mon Dec 11 17:04:52 EST 2006


Xiaojian Wang wrote:
> /Hi,   I can generate uniform random numbers, using random(),/
> /I would like to know if there is any library in python can generate /
> /normal distribution numbers./

Yes.

In [18]: import numpy

In [19]: print dir(numpy.random)
['RandomState', '__RandomState_ctor', '__all__', '__builtins__', '__doc__',
'__file__', '__name__', '__path__', 'beta', 'binomial', 'bytes', 'chisquare',
'exponential', 'f', 'gamma', 'geometric', 'get_state', 'gumbel',
'hypergeometric', 'info', 'laplace', 'logistic', 'lognormal', 'logseries',
'mtrand', 'multinomial', 'multivariate_normal', 'negative_binomial',
'noncentral_chisquare', 'noncentral_f', 'normal', 'pareto', 'permutation',
'poisson', 'power', 'rand', 'randint', 'randn', 'random', 'random_integers',
'random_sample', 'ranf', 'rayleigh', 'sample', 'seed', 'set_state', 'shuffle',
'standard_cauchy', 'standard_exponential', 'standard_gamma', 'standard_normal',
'standard_t', 'test', 'triangular', 'uniform', 'vonmises', 'wald', 'weibull',
'zipf']

In [20]: numpy.random.normal?
Type:           builtin_function_or_method
Base Class:     <type 'builtin_function_or_method'>
Namespace:      Interactive
Docstring:
    Normal distribution (mean=loc, stdev=scale).

    normal(loc=0.0, scale=1.0, size=None) -> random values


-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco



More information about the SciPy-User mailing list