diff --git a/support/include/utils/common.hpp b/support/include/utils/common.hpp index a7937906..365491cb 100644 --- a/support/include/utils/common.hpp +++ b/support/include/utils/common.hpp @@ -114,9 +114,8 @@ inline auto generate_random_between(data_t begin, data_t end) -> data_t { throw std::range_error("end must be greater than begin"); } - thread_local std::random_device rd{}; - thread_local std::mt19937 gen( - static_cast(std::time(nullptr) ^ rd())); + thread_local std::mt19937 gen(static_cast( + std::time(nullptr) ^ std::random_device rd{}())); std::uniform_int_distribution dis(begin, end); return dis(gen); } diff --git a/support/test/src/test.cpp b/support/test/src/test.cpp index c93d76fb..3086778d 100644 --- a/support/test/src/test.cpp +++ b/support/test/src/test.cpp @@ -64,9 +64,8 @@ auto create_random_file(std::size_t size) -> utils::file::i_file & { #if defined(PROJECT_ENABLE_LIBSODIUM) randombytes_buf(buf.data(), buf.size()); #else // !defined(PROJECT_ENABLE_LIBSODIUM) - thread_local std::random_device rd{}; - thread_local std::mt19937 gen( - static_cast(std::time(nullptr) ^ rd())); + thread_local std::mt19937 gen(static_cast( + std::time(nullptr) ^ std::random_device rd{}())); std::uniform_int_distribution dis(0U, 255U); std::generate(buf.begin(), buf.end(), [&]() -> auto { return dis(gen); }); #endif // defined(PROJECT_ENABLE_LIBSODIUM)