JuliaRandom / JuliaRandom/RandomNumbers.jl
Seed sequence
- Langage dominant
- Julia
- Étoiles
- 100
- Forks
- 23
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Start by reviewing the dSFMT.c initialization code and libstdc++-v3/include/bits/random.tcc around the referenced lines, then compare them with the current RNG seeding implementation in RandomNumbers.jl. Define and test a seed-sequence approach that expands small integer seeds into a suitable full state without producing the problematic zero-heavy starting states.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- julia
- Domaine
- backend
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100