作者WengeKong (早知道就去欧洲定居)
看板Python
标题[问题] numpy.random.randint的用法解释
时间Fri Aug 2 12:36:29 2019
看document
https://
docs.scipy.org/doc/numpy-1.15.1/reference/generated/numpy.random.randint.html
low : int
Lowest (signed) integer to be drawn from the distribution
(unless high=None, in which case this parameter is one above the highest such
integer).
可是为什麽下面范例
np.random.randint(2, size=10)
抽出的值是0跟1?
(unless high=None, in which case this parameter is one above the highest such
integer).
this parameter "2" is one above the highest such integer
的意思是说 抽出的最大值是2-1
这样理解对吗? such integer说的是抽出的integer?
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 80.213.1.89 (挪威)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1564720591.A.B8D.html
1F:推 legendmtg: 除非你有给high 否则low就是high 08/02 15:05
2F:→ germun: high是None的情况下, 你给的low会当成high, 而low预设为0 08/02 15:28
3F:→ germun: range也是类似的做法 08/02 15:28