JuliaRandom / JuliaRandom/RandomNumbers.jl

Seed sequence

Đang mở
#12 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Julia
Star
100
Fork
23
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Previously I realized how bad the current implementation of using integers with small entropy to initialize a big-state RNG is. If we directly use small integers like 1, 2, 3 to be the initial states of xor-based RNGs (such as Xorshift), the starting sequences will probably poorly random. This is caused by the zeros in the state.
E.g.: https://sunoru.github.io/RNG.jl/latest/man/mersenne-twisters/#Examples-1

MT19937 uses an initialization function to avoid this situation. It performs a iterative transformation on one `UInt32` seed to generate a 623-`UInt32`s state. (And I still don't understand how people come up with the constants 1812433253 and 6364136223846793005)

C++'s `seed_seq` may be a valuable reference, although [this blog](http://www.pcg-random.org/posts/cpp-seeding-surprises.html) shows its flaws.

I have looked at how `dSFMT` and `libstdc++` deal with it:
https://github.com/MersenneTwister-Lab/dSFMT/blob/c6bf8a8dab3710b7abd86c4b68d0e6b4aa5e6db1/dSFMT.c#L554
https://github.com/atgreen/gcc/blob/76cc869aa9710764c7732d9bca0740fcf6865a27/libstdc%2B%2B-v3/include/bits/random.tcc#L3398
and they seem to be using similar methods..

@simonbyrne

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.