diff --git a/src/ipc.cpp b/src/ipc.cpp index 2467b791b..b1ec605e7 100644 --- a/src/ipc.cpp +++ b/src/ipc.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -85,9 +86,11 @@ IPC::IPC(uint32_t profileId) // If the owner exits normally, it can set the timestamp to 0 first to immediately give // ownership - std::default_random_engine randEngine((std::random_device())()); + // use the clock rather than std::random_device because std::random_device may return constant values, and does + // under mingw on Windows. We don't actually need cryptographic guarantees, so using the clock in all cases. + static std::mt19937 rng(std::chrono::high_resolution_clock::now().time_since_epoch().count()); std::uniform_int_distribution distribution; - globalId = distribution(randEngine); + globalId = distribution(rng); qDebug() << "Our global IPC ID is " << globalId; if (globalMemory.create(sizeof(IPCMemory))) { if (globalMemory.lock()) {