better seed randomization for systems with poor clock() resolutation
This commit is contained in:
parent
23ba41533a
commit
3f01c8833f
@ -847,7 +847,12 @@ int main(int argc, const char** argv)
|
|||||||
/* Get Seed */
|
/* Get Seed */
|
||||||
DISPLAY("Starting zstd tester (%i-bits, %s)\n", (int)(sizeof(size_t)*8), ZSTD_VERSION_STRING);
|
DISPLAY("Starting zstd tester (%i-bits, %s)\n", (int)(sizeof(size_t)*8), ZSTD_VERSION_STRING);
|
||||||
|
|
||||||
if (!seedset) seed = (U32)(clock() % 10000);
|
if (!seedset) {
|
||||||
|
time_t const t = time(NULL);
|
||||||
|
U32 const h = XXH32(&t, sizeof(t), 1);
|
||||||
|
seed = h % 10000;
|
||||||
|
}
|
||||||
|
|
||||||
DISPLAY("Seed = %u\n", seed);
|
DISPLAY("Seed = %u\n", seed);
|
||||||
if (proba!=FUZ_compressibility_default) DISPLAY("Compressibility : %u%%\n", proba);
|
if (proba!=FUZ_compressibility_default) DISPLAY("Compressibility : %u%%\n", proba);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user