low : int #产生随机数的最小值 high : int, optional #给随机数设置个上限,即产生的随机数必须小于high size : int or tuple of ints, optional #输出的大小,可以是整数,或者元组 dtype : dtype, optional #期望结果的类型 numpy.random.randint的low、high、size三个参数。默认high是None,如果只有low,那范围就是[0,low)。如果有high,范围就是[low,high)。 实例如下:
输出为: w----------- [[1 0 0] [0 0 0]] w1----------- [0 4 4 0 1 4 2 1] |
|