All random numbers generated via one PRNG seeded in one place.
[invirt/third/libt4.git] / rpc / connection.cc
index 31ec5fa..8966cc2 100644 (file)
@@ -56,7 +56,7 @@ bool connection::send(const string & b) {
 
     wpdu_ = {inflight, b, 0};
 
-    if (lossy_ && (random()%100) < lossy_) {
+    if (std::bernoulli_distribution(lossy_*.01)(global->random_generator)) {
         IF_LEVEL(1) LOG << "send LOSSY TEST shutdown fd " << fd;
         shutdown(fd,SHUT_RDWR);
     }