Conversation
36155ee to
bc7d95c
Compare
| uint64_t seed = static_cast<uint64_t>(std::random_device{}()); | ||
| #else | ||
| uint32_t seed = static_cast<uint32_t>(std::hash<std::string>{}(std::to_string(rand()))); | ||
| uint64_t seed = static_cast<uint64_t>(std::hash<std::string>{}(std::to_string(rand()))); |
There was a problem hiding this comment.
| uint64_t seed = static_cast<uint64_t>(std::hash<std::string>{}(std::to_string(rand()))); | |
| uint64_t seed = static_cast<uint64_t>(rand()); |
This string hash dance is ultimately pointless. Some checking of RAND_MAX could find it better to do (uint64_t)rand() | (uint64_t)rand() << 32
I left as is since this PR is focused on removing boost/random & replacing MT, but if nobody objects it'd be nice to change this too
There was a problem hiding this comment.
i know this PR is closed but i do want to note something:
that line is behind a switch/wii u ifdef
as for how it got there, we originally had
Shipwright/soh/soh/Enhancements/randomizer/3drando/random.cpp
Lines 15 to 23 in 7fb8902
which was added in #416
then it was updated to
Shipwright/soh/soh/Enhancements/randomizer/3drando/random.cpp
Lines 18 to 30 in 7df9641
in #1608
not sure why the "dance" was used as a fix for wii u but that's the origin story at least
6fca562 to
67e6bbd
Compare
67e6bbd to
12e7ea2
Compare
Mersenne Twister isn't a particularly good RNG
For info about PCG see https://www.pcg-random.org
I've adapted the RNG I used in openEtG: https://github.com/serprex/openEtG/blob/master/src/rs/src/rng.rs
Which is based on rand_pcg of widely used rand crate: https://rust-random.github.io/rand/src/rand_pcg/pcg64.rs.html#140
This also reduces usage of boost, which could eventually be removed
Build Artifacts