Skip to content

Commit

Permalink
Use std::clamp instead of if condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackarain committed Nov 22, 2023
1 parent 5245179 commit 0a547f7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions proxy/include/proxy/proxy_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,7 @@ R"x*x(<html>
static std::normal_distribution<> dis(5, 4);

int num = static_cast<int>(dis(gen));
if (num < 0) num = 0;
if (num > 10) num = 10;
num = std::clamp(num, 0, 10);

return pos[num];
}
Expand Down

0 comments on commit 0a547f7

Please sign in to comment.