简体   繁体   中英

Generating a numpy random see array of 100 random numbers drawn from a normal distribution with mean 1 and standard deviation 2

np.random.seed(my_seed)

from math import *
import numpy as np

A = np.arrange(100)

I have this however unsure how to deal with mean of and standard deviation

You can use this:

mu, sigma = 1, 2 # mean and standard deviation
s = np.random.normal(mu, sigma, 100)


#to find Standard Deviation and mean:
x = np.random.randn(100)
mean = x.mean()
std = x.std()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM