numpy.random.randint(low, high=None, size=None, dtype=’l’)
输入:
low—–为最小值
high—-为最大值
size—–为数组维度大小
dtype—为数据类型,默认的数据类型是np.int。
返回值:
返回随机整数或整型数组,范围区间为[low,high),包含low,不包含high;
high没有填写时,默认生成随机数的范围是[0,low)
举例:
import numpy as np
index = np.random.randint(0, 1000, 5)
print(index)
# 输出结果为[0, 1000) 范围内的5个数
# 输出结果为[408 242 581 337 540]