Skip to content

Instantly share code, notes, and snippets.

@rsnemmen
Created October 23, 2014 21:45
Show Gist options
  • Save rsnemmen/d022dbbdea670481f472 to your computer and use it in GitHub Desktop.
Save rsnemmen/d022dbbdea670481f472 to your computer and use it in GitHub Desktop.
Generates random numbers following a normal distribution with arbitrary mean and standard deviation
def random_normal(mean,std,n):
"""
Returns an array of n elements of random variables, following a normal
distribution with the supplied mean and standard deviation.
"""
import scipy
return std*scipy.random.standard_normal(n)+mean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment