mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Merge pull request #34473 from DevTeamBK/divide_by_zero
clang-tidy reported potential chance for divide by zero exception
This commit is contained in:
commit
66386aab1b
@ -239,6 +239,7 @@ private:
|
||||
|
||||
UInt64 genRandom(size_t lim)
|
||||
{
|
||||
assert(lim > 0);
|
||||
/// With a large number of values, we will generate random numbers several times slower.
|
||||
if (lim <= static_cast<UInt64>(rng.max()))
|
||||
return static_cast<UInt32>(rng()) % static_cast<UInt32>(lim);
|
||||
|
Loading…
Reference in New Issue
Block a user