numpy.random.SeedSequence.generate_state#

method

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,)