>>> mu, sigma = 0, 0.1 # mean and standard deviation >>> s = np.random.normal(mu, sigma, 1000)
def normalize(v): norm = np.linalg.norm(v) if norm == 0: return v return v / norm