Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
RyeMutt committed Apr 17, 2024
1 parent 03323c6 commit 1ccc185
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions indra/llcommon/llrand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 1ccc185

Please sign in to comment.