diff --git a/src/random.cpp b/src/random.cpp index f31d14acf..6b7962aa1 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -297,10 +297,11 @@ void GetRandBytes(unsigned char* buf, int num) namespace { struct RNGState { Mutex m_mutex; - unsigned char m_state[32] = {0}; - uint64_t m_counter = 0; + unsigned char m_state[32] GUARDED_BY(m_mutex) = {0}; + uint64_t m_counter GUARDED_BY(m_mutex) = 0; - explicit RNGState() { + RNGState() + { InitHardwareRand(); } };