Open define-private-public opened 2 months ago
Hi. Yes I think that the pcg32 implementation is fully platform independent due to the correct use of types (this is not my merit, see citations in the code). This produces a platform independent uniform distribution. Then porting to other distribution platform independently is sort of trivial up to floating point precision.
I have written this library precisely because I needed to regenerate distributions on different platforms. Please refer to the CI for tests. In doubt you can run them on your platforms to be sure.
Is there an easy way to "consume" this library? e.g. "Just include this one header and you're good to go?" Or is there some more stuff involved? I'm looking for a solution that relies on vanilla-as-possible-C++.
Just include the header (and the headers of needed/wanted libraries)
Hi.
I have a C++ project that uses PCG32 in conjunction with
std::uniform_real_distribution()
. Unfortunately thestd::uniform_*()
functions are [https://www.reddit.com/r/cpp/comments/7i21sn/til_uniform_int_distribution_is_not_portable/](not portable) across OS and compiler.In my project some scenes use an RNG to place their objects. For about 70% of cases the object placement was the same on different compilers and operating systems (e.g. GCC & MSVC were the same on Linux and Windows), but sometimes some objects were placed differently (e.g. from clang on macOS & Linux) when using the same C++ code and random seed.
Is prrng 100% fully portable? I understand it uses PCG32 under the hood, but is its distribution function 100% portable across compilers and operating systems? If so, I'd really like to use.