import numpy as np
if __name__ == '__main__':
i = 0
while(i<6):
if(i<3):
np.random.seed(0)
print(np.random.randn(1, 5))
else:
print(np.random.randn(1, 5))
pass
i += 1
i = 0
while(i<2):
print(np.random.randn(1, 5))
i += 1
print('*************************')
print(np.random.randn(2, 5))
print('*************************')
np.random.seed(0)
i = 0
while(i<8):
print(np.random.randn(1, 5))
i += 1
相同的np.random.seed(0) 所构造出的随机矩阵,是内容起点和顺序一致的;
import numpy as np
if __name__ == '__main__':
i = 0
np.random.seed(0)
while(i<3):
print(np.random.randn(1, 5))
i += 1
i = 0
np.random.seed(1)
i = 0
while(i<3):
print(np.random.randn(1, 5))
i += 1
不同的np.random.seed(0) 和 np.random.seed(1) 的随机矩阵的内容起点和顺序是不一样的;
ref:https://www.cnblogs.com/subic/p/8454025.html