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’)也可以。请注意,请求 uint64 将比 uint32 多绘制两倍的位数(对于相同的 n_words)。这是一种方便,适用于将状态表示为 uint64 数组的 BitGenerator

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