Skip to content
Snippets Groups Projects
Commit 1ccc1859 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Cleanup

parent 03323c64
No related branches found
No related tags found
No related merge requests found
......@@ -60,17 +60,12 @@
* to restore uniform distribution.
*/
// gRandomGenerator is a stateful static object, which is therefore not
// inherently thread-safe.
static thread_local std::unique_ptr<std::ranlux48> __generator;
inline std::ranlux48* _generator()
{
if (!__generator.get())
{
std::random_device seeder;
// Per Monty, it's important to clamp using the correct fmodf() rather
// than expanding to F64 for fmod() and then truncating back to F32. Prior
// to this change, we were getting sporadic ll_frand() == 1.0 results.
__generator = std::make_unique<std::ranlux48>(seeder());
}
return __generator.get();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment