上一个主题

numpy.random.RandomState.standard_t

下一个主题

numpy.random.RandomState.triangular

numpy.random.RandomState.tomaxint

方法

RandomState.tomaxint(size=None)

0到之间的随机整数 sys.maxint 包括在内。

返回间隔中均匀分布随机整数的样本 [0, sys.maxint] .

参数:
size : int或int的元组,可选

输出形状。如果给定的形状是,例如, (m, n, k) 然后 m * n * k 取样。默认值为无,在这种情况下返回单个值。

返回:
out : 恩达雷

绘制样本,带形状 size .

参见

randint
给定半开整数区间上的均匀抽样。
random_integers
给定整数闭区间上的均匀抽样。

实例

>>> RS = np.random.mtrand.RandomState() # need a RandomState object
>>> RS.tomaxint((2,2,2))
array([[[1170048599, 1600360186],
        [ 739731006, 1947757578]],
       [[1871712945,  752307660],
        [1601631370, 1479324245]]])
>>> import sys
>>> sys.maxint
2147483647
>>> RS.tomaxint((2,2,2)) < sys.maxint
array([[[ True,  True],
        [ True,  True]],
       [[ True,  True],
        [ True,  True]]])