from numpy import random
random.seed(1001)
array=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]]
Random seed each time the same data out random
from numpy import random
np.random.choice():
Random numpy Import from # TODO random.seed (1001), whether a seed number per set are valid for np.random.xx hereinafter unique = np.random.choice (range (0,3) , (3,4 )) # TODO [0,10) -> five pump, sampling with replacement [1 7 0 7 1 2 3 ], replace = False sampling without replacement unique2 = np.random.choice (10,7, replace = True) Print ( "the Range (0,3) ---> sampling with replacement:", UNIQUE, sep = "\ the n-") Print ( "============") Print ( " [0,10) -> five pump, sampling with replacement ", the unique2) # # of dataframe SET Columns: 1.df.columns = [" X1 "," X1 ".....] Print (PD. DataFrame (unique, columns = [f "x {i}" for i in range (4)]))