Fix unusual shit

This commit is contained in:
Alexey Milovidov 2023-11-07 00:09:22 +01:00
parent 99522df3c1
commit 04b81ef6a8
2 changed files with 3 additions and 3 deletions

View File

@ -89,7 +89,7 @@ struct GroupArraySamplerData
/// 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);
return rng() % lim;
else
return (static_cast<UInt64>(rng()) * (static_cast<UInt64>(rng.max()) + 1ULL) + static_cast<UInt64>(rng())) % lim;
}

View File

@ -255,11 +255,11 @@ private:
UInt64 genRandom(UInt64 limit)
{
assert(limit > 0);
chassert(limit > 0);
/// With a large number of values, we will generate random numbers several times slower.
if (limit <= static_cast<UInt64>(rng.max()))
return static_cast<UInt32>(rng()) % static_cast<UInt32>(limit);
return rng() % limit;
else
return (static_cast<UInt64>(rng()) * (static_cast<UInt64>(rng.max()) + 1ULL) + static_cast<UInt64>(rng())) % limit;
}