mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-10-01 03:43:51 +08:00
common/util: move function random_int to util (#29388)
This commit is contained in:
@@ -43,13 +43,6 @@ TEST_CASE("httpMultiPartDownload") {
|
||||
REQUIRE(sha256(content) == TEST_RLOG_CHECKSUM);
|
||||
}
|
||||
|
||||
int random_int(int min, int max) {
|
||||
std::random_device dev;
|
||||
std::mt19937 rng(dev());
|
||||
std::uniform_int_distribution<std::mt19937::result_type> dist(min, max);
|
||||
return dist(rng);
|
||||
}
|
||||
|
||||
TEST_CASE("FileReader") {
|
||||
auto enable_local_cache = GENERATE(true, false);
|
||||
std::string cache_file = cacheFilePath(TEST_RLOG_URL);
|
||||
@@ -198,7 +191,7 @@ void TestReplay::test_seek() {
|
||||
QEventLoop loop;
|
||||
std::thread thread = std::thread([&]() {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
testSeekTo(random_int(0, 1 * 60));
|
||||
testSeekTo(util::random_int(0, 1 * 60));
|
||||
}
|
||||
loop.quit();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user