updated build system

This commit is contained in:
2024-08-31 19:34:24 -05:00
parent efdea15f4c
commit 986e61cf54
3 changed files with 7 additions and 4 deletions

View File

@ -114,8 +114,9 @@ inline auto generate_random_between(data_t begin, data_t end) -> data_t {
throw std::range_error("end must be greater than begin");
}
std::random_device rd{};
std::mt19937 gen(static_cast<unsigned long>(std::time(nullptr) ^ rd()));
thread_local std::random_device rd{};
thread_local std::mt19937 gen(
static_cast<unsigned long>(std::time(nullptr) ^ rd()));
std::uniform_int_distribution<data_t> dis(begin, end);
return dis(gen);
}

View File

@ -67,7 +67,7 @@ auto compare_version_strings(std::wstring_view version1,
#if defined(PROJECT_ENABLE_STDUUID)
auto create_uuid_string() -> std::string {
std::random_device random_device;
std::random_device random_device{};
auto seed_data = std::array<int, std::mt19937::state_size>{};
std::generate(std::begin(seed_data), std::end(seed_data),
std::ref(random_device));

View File

@ -64,7 +64,9 @@ 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)
std::mt19937 gen(std::random_device{}());
thread_local std::random_device rd{};
thread_local std::mt19937 gen(
static_cast<unsigned long>(std::time(nullptr) ^ rd()));
std::uniform_int_distribution<std::uint8_t> dis(0U, 255U);
std::generate(buf.begin(), buf.end(), [&]() -> auto { return dis(gen); });
#endif // defined(PROJECT_ENABLE_LIBSODIUM)