numpy.random.SeedSequence.generate_state#

方法

random.SeedSequence.generate_state(n_words, dtype=np.uint32)#

返回 PRNG 种子所需的字数。

BitGenerator 应在其构造函数中调用此方法,并传入适当的 n_words 参数以正确地设置自身种子。

参数:
n_wordsint
dtypenp.uint32 或 np.uint64, 可选

每个字的大小。这应仅为 uint32uint64。字符串(‘uint32’, ‘uint64’)也可以。请注意,对于相同的 n_words,请求 uint64 将比 uint32 抽取两倍的位数。这对于将其状态表示为 uint64 数组的 BitGenerator 来说很方便。

返回:
stateuint32 或 uint64 数组, 形状=(n_words,)