I am using ZMQ 4.1.2 on Ubuntu 10.04.5 LTS.
I have a c++ program that seeds srand() with a fixed number, and then calls rand() ~100k times and exists. I found that I was getting different random numbers when re-running the same program twice.
If I have a ZMQ socket open before I start my 100k draws it seems like the ZMQ library itself is calling rand() and messing up my repeatability.
this->context = new zmq::context_t(1);
this->socket = new zmq::socket_t(*this->context, ZMQ_PUB);
socket->connect("tcp://localhost:5556"); // offending line
All I need to do is omit calling socket->connect() and my calls to rand() behave deterministically.
Is this a bug (feature) in ZMQ? Or does this also happen with the underlying TCP socket?
Aucun commentaire:
Enregistrer un commentaire