본문 바로가기
코딩/기억이 날듯 말듯

np.random.seed(0)

by 세자책봉 2020. 12. 29.
728x90

쉽게 보자

생성된 난수를 시드에 저장하여 시드가 바뀌지 않을 경우 값을 유지

시드의 숫자가 변하지 않으면 계속 같은 값을 반환함

- np.random.seed(0)
- np.random.randn(100, 2)

array([[ 1.62434536, -0.61175641], [-0.52817175, -1.07296862], [ 0.86540763, -2.3015387 ], [ 1.74481176, -0.7612069 ], [ 0.3190391 , -0.24937038], ... 

 

- np.random.randn(100, 2)

array([[ 1.62434536, -0.61175641], [-0.52817175, -1.07296862], [ 0.86540763, -2.3015387 ], [ 1.74481176, -0.7612069 ], [ 0.3190391 , -0.24937038], ... 

 

- np.random.seed(1)
- np.random.randn(100, 2)

array([[-4.16757847e-01, -5.62668272e-02], [-2.13619610e+00, 1.64027081e+00], [-1.79343559e+00, -8.41747366e-01], [ 5.02881417e-01, -1.24528809e+00], [-1.05795222e+00, -9.09007615e-01], ...

 

 

 

반응형

'코딩 > 기억이 날듯 말듯' 카테고리의 다른 글

subplot, subplots, fig, ax  (0) 2021.01.01
np.random.randint, np.random.rand, np.random.randn  (0) 2020.12.29

댓글