JuliaRandom / JuliaRandom/RandomNumbers.jl

Seed sequence

Abierto
#12 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Julia
Estrellas
100
Forks
23
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.