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