We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cddb31b commit f2e60caCopy full SHA for f2e60ca
src/random.cpp
@@ -19,6 +19,8 @@
19
#include <chrono>
20
#include <thread>
21
22
+#include <support/allocators/secure.h>
23
+
24
#ifndef WIN32
25
#include <fcntl.h>
26
#include <sys/time.h>
@@ -351,8 +353,8 @@ RNGState& GetRNGState() noexcept
351
353
{
352
354
// This C++11 idiom relies on the guarantee that static variable are initialized
355
// on first call, even when multiple parallel calls are permitted.
- static std::unique_ptr<RNGState> g_rng{new RNGState()};
- return *g_rng;
356
+ static std::vector<RNGState, secure_allocator<RNGState>> g_rng(1);
357
+ return g_rng[0];
358
}
359
360
0 commit comments