normal distribution using normalin [ ]samples np random normal(size=( )in [ ]samples out[ ]array([ ] - - - ][- - - ] - - ]]python' built-in random moduleby contrastonly samples one value at time as you can see from this benchmarknumpy random is well over an order of magnitude faster for generating very large samplesin [ ]from random import normalvariate in [ ] in [ ]%timeit samples [normalvariate( for in xrange( ) loopsbest of per loop in [ ]%timeit np random normal(size= loopsbest of ms per loop see table table - for partial list of functions available in numpy random 'll give some examples of leveraging these functionsability to generate large arrays of samples all at once in the next section table - partial list of numpy random functions function description seed seed the random number generator permutation return random permutation of sequenceor return permuted range shuffle randomly permute sequence in place rand draw samples from uniform distribution randint draw random integers from given low-to-high range randn draw samples from normal distribution with mean and standard deviation (matlab-like interfacebinomial draw samples binomial distribution normal draw samples from normal (gaussiandistribution beta draw samples from beta distribution chisquare draw samples from chi-square distribution gamma draw samples from gamma distribution uniform draw samples from uniform [ distribution random number generation www it-ebooks info