np.random.normal(0,1,(3,4))  # <class 'numpy.ndarray'>
print(array)
# [[-1.08644637 - 0.89606513 - 0.30629937 - 1.33993366]
# [-1.20658558 - 0.64172681 1.30794563 1.84546043]
# [0.82911495 - 0.02329881 - 0.20856395 - 0.91661975]]

 随机种子,每次随机一样的数据出来

 from numpy  import random  

np.random.choice()

from numpy import  random
# todo random.seed(1001) ,是否每次使用一个种子数,设置对np.random.xx下文均有效
unique= np.random.choice(range(0,3),(3,4))
print("range(0,3)--->放回抽样:",unique,sep="\n")

print("============")

unique2 = np.random.choice(10, 7, replace=True)
print("[0,10)-->抽五个,放回抽样",unique2)
# # set columns of dataframe : 1.df.columns=["x1","x1".....]
print(pd.DataFrame(unique,columns=[f"x{i}" for i in range(4)]))

  

numpy 随机种子_数据