numpy.random.SeedSequence.generate_state#
method
- random.SeedSequence.generate_state(n_words, dtype=np.uint32)#
返回 PRNG 播种所需的字数.
BitGenerator 应在其构造函数中调用此方法,并带有适当的 n_words 参数,以正确地为自身播种.
- 参数:
- n_wordsint
- dtypenp.uint32 or np.uint64, optional
每个字的大小. 这应该只是 uint32 或 uint64 . 字符串( ‘uint32’ , ‘uint64’ )也可以. 请注意,对于相同的 n_words ,请求 uint64 将提取两倍于 uint32 的位数. 这对于将其状态表示为 uint64 数组的
BitGenerators 来说很方便.
- 返回:
- stateuint32 或 uint64 数组,形状=(n_words,)