Skip to content

Commit

Permalink
[coro_io][fix] init random seed for RandomLoadBlancer (#715)
Browse files Browse the repository at this point in the history
  • Loading branch information
poor-circle authored Jul 12, 2024
1 parent 2f287f0 commit ce86b8b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/ylt/coro_io/channel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class channel {
struct RandomLoadBlancer {
async_simple::coro::Lazy<std::shared_ptr<client_pool_t>> operator()(
const channel& channel) {
static thread_local std::default_random_engine e;
static thread_local std::default_random_engine e(std::time(nullptr));
std::uniform_int_distribution rnd{std::size_t{0},
channel.client_pools_.size() - 1};
co_return channel.client_pools_[rnd(e)];
Expand Down

0 comments on commit ce86b8b

Please sign in to comment.