QuantEcon/QuantEcon.jl

Use `StableRNGs` in tests

開放

#275 建立於 2022年7月5日

 (0 則留言) (1 個反應) (0 位負責人)Julia (300 個分叉)batch import
enhancementhelp wantedtest

倉庫指標

星標
 (495 顆星)
PR 合併指標
 (平均合併 1天 1小時) (30 天內合併 2 個 PR)

描述

@oyamad asked me to expand my comment in #274 into an issue. Here it is.

A lot of tests currently depend on outcomes of simulations. In order to get reproducible results, the tests set seeds. However the random number streams are not guaranteed to be the same across Julia versions. This led to the problem visible in #274: a test suddenly broke on Julia 1.7 and above.

In order to avoid this one can use the package https://github.com/JuliaRandom/StableRNGs.jl, which guarantees reproducible streams of random numbers across Julia versions.

I am afraid that this would require rewriting some of the functionality of this package to accept an RNG as in

rng = StableRNG(seed::Integer) # random number generator object
rand(rng, X)

貢獻者指南