官方文档
numpy.random.randint(low, high=None, size=None, dtype='l')low (inclusive) to high (exclusive)的随机整数。
如果默认high=None,则取[0, low)
Parameters
low
从分布中提取的最小的整数
high
分布中提取的最大值
size:int or tuple of ints, optional
输出形态,例如(m,n,k),默认为None,表示给出单值
dtype:dtype, optional
获得的数据类型
返回值:int or ndarray of ints。size-shaped array
示例
np.random.randint(5, size=(2, 4)) array([[4, 0, 2, 1], [3, 2, 2, 0]])
版权声明:本文为The_Time_Runner原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。