You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/02/25 01:16:11 UTC

[GitHub] [pulsar] BewareMyPower commented on a change in pull request #9702: [C++] SinglePartition message router is always picking the same partition

BewareMyPower commented on a change in pull request #9702:
URL: https://github.com/apache/pulsar/pull/9702#discussion_r582420498



##########
File path: pulsar-client-cpp/lib/SinglePartitionMessageRouter.cc
##########
@@ -18,9 +18,23 @@
  */
 #include "SinglePartitionMessageRouter.h"
 
+#include <boost/random/mersenne_twister.hpp>
+#include <boost/random/uniform_int_distribution.hpp>
+#include <chrono>
+
 namespace pulsar {
 SinglePartitionMessageRouter::~SinglePartitionMessageRouter() {}
+
+SinglePartitionMessageRouter::SinglePartitionMessageRouter(const int numberOfPartitions,
+                                                           ProducerConfiguration::HashingScheme hashingScheme)
+    : MessageRouterBase(hashingScheme) {
+    boost::random::mt19937 rng(std::chrono::high_resolution_clock::now().time_since_epoch().count());
+    boost::random::uniform_int_distribution<int> dist;

Review comment:
       Should we use `std::random` from C++ standard library instead of `boost::random`?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org