numpy.random.randint
Return random integers from the “discrete uniform” distribution of the specified dtype in the “half-open” interval [low, high). If high is None (the default), then results are from [0, low).
즉 'discrete uniform (이산균등분포)'로써 랜덤한 정수를 반환해주는 함수이다. 이산균등분포란 확률 함슈가 정의된 모든 곳에서 그 값이 일정한 분포를 나타낸다는 것이다. 대표적인 예로 주사위를 들 수 있다. 주사위는 1, 2, 3, 4, 5, 6의 값을 갖고, 주사위를 굴렸을때 각각의 값이 나올 확률은 1/6 이다.
import numpy as np
data = np.random.randint(5)
print(data)
data = np.random.randint(1, 10)
print(data)
Reference
https://en.wikipedia.org/wiki/Discrete_uniform_distribution
Discrete uniform distribution - Wikipedia
From Wikipedia, the free encyclopedia Jump to navigation Jump to search Probability distribution on equally likely outcomes discrete uniform Probability mass functionn = 5 where n = b − a + 1 Cumulative distribution functionNotation U { a , b } {\dis
en.wikipedia.org
https://numpy.org/doc/stable/reference/random/generated/numpy.random.randint.html
numpy.random.randint — NumPy v1.22 Manual
Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.
numpy.org
'PYTHON > NUMPY' 카테고리의 다른 글
[Numpy] 넘파이 csv 파일 읽기 (0) | 2020.05.12 |
---|