artdaq_core  v3_04_09
SharedMemoryTestShims.hh
1 #ifndef ARTDAQ_CORE_TEST_CORE_SHAREDMEMORYTESTSHIMS_HH
2 #define ARTDAQ_CORE_TEST_CORE_SHAREDMEMORYTESTSHIMS_HH
3 
4 #include <random>
5 #include "artdaq-core/Utilities/TimeUtils.hh"
6 
7 inline unsigned GetRandomKey(uint16_t identifier)
8 {
9 
10  static std::mt19937 rng(artdaq::TimeUtils::gettimeofday_us());
11  static std::uniform_int_distribution<unsigned> gen(0x00000000, 0x0000FFFF);
12  return gen(rng) + (identifier << 16);
13 }
14 
15 #endif
uint64_t gettimeofday_us()
Get the current time of day in microseconds (from gettimeofday system call)
Definition: TimeUtils.cc:51