New pseudo random number generator
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-win (push) Waiting to run
CodeQL / Analyze (push) Waiting to run

This commit is contained in:
Andrea Mazzoleni 2026-01-05 17:20:22 +01:00
parent 0aafcd1819
commit 13fae39eb3
6 changed files with 80 additions and 33 deletions

View file

@ -1622,16 +1622,6 @@ static int devup(dev_t device, const char* name)
void* buf;
uint64_t size;
uint64_t offset;
uint64_t pseudo_random;
/* get a pseudo random number */
ret = randomize(&pseudo_random, sizeof(pseudo_random));
if (ret < 0) {
/* LCOV_EXCL_START */
log_fatal("Failed to retrieve random values.\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
if (devresolve(device, file, sizeof(file)) != 0) {
/* LCOV_EXCL_START */
@ -1669,7 +1659,7 @@ static int devup(dev_t device, const char* name)
}
/* select a random offset */
offset = (pseudo_random % (size / 4096)) * 4096;
offset = (random_u64() % (size / 4096)) * 4096;
#if HAVE_POSIX_FADVISE
/* clear cache */