diff --git a/ecal/core/src/io/udp/snd_raw_buffer.cpp b/ecal/core/src/io/udp/snd_raw_buffer.cpp index e90875af88..2ab8c15e2f 100644 --- a/ecal/core/src/io/udp/snd_raw_buffer.cpp +++ b/ecal/core/src/io/udp/snd_raw_buffer.cpp @@ -21,6 +21,8 @@ * @brief raw message buffer handling **/ +#include +#include #include #include "ecal_process.h" @@ -129,8 +131,18 @@ namespace eCAL msg_header.type = msg_type_header; { // create random number for message id - static unsigned long x = 123456789, y = 362436069, z = 521288629; - msg_header.id = xorshf96(x, y, z); + { + static std::mutex xorshf96_mtx; + const std::lock_guard lock(xorshf96_mtx); + + static unsigned long x = static_cast(std::chrono::duration_cast( + std::chrono::high_resolution_clock::now().time_since_epoch()).count() + ); + static unsigned long y = 362436069; + static unsigned long z = 521288629; + + msg_header.id = xorshf96(x, y, z); + } } msg_header.num = total_packet_num; msg_header.len = int32_t(buf_len_);