Merge pull request #34473 from DevTeamBK/divide_by_zero

clang-tidy reported potential chance for divide by zero exception
This commit is contained in:
Maksim Kita 2022-02-10 21:19:16 +01:00 committed by GitHub
commit 66386aab1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);