mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
tests/fate-run: Ensure that THREADS=random is actually random
From the documentation of GNU awk [1]: "In most awk implementations, including gawk, rand() starts generating numbers from the same starting number, or seed, each time you run awk.45 Thus, a program generates the same results each time you run it. The numbers are random within one awk run but predictable from run to run. This is convenient for debugging, but if you want a program to do different things each time it is used, you must change the seed to a value that is different in each run. To do this, use srand()." This commit does exactly this. [1]: https://www.gnu.org/software/gawk/manual/html_node/Numeric-Functions.html#index-rand_0028_0029-function Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
3bef108fa9
commit
8d5db120c2
@ -37,7 +37,7 @@ case $threads in
|
|||||||
random*)
|
random*)
|
||||||
threads_max=${threads#random}
|
threads_max=${threads#random}
|
||||||
[ -z "$threads_max" ] && threads_max=16
|
[ -z "$threads_max" ] && threads_max=16
|
||||||
threads=$(awk "BEGIN { print 1+int(rand() * $threads_max) }" < /dev/null)
|
threads=$(awk "BEGIN { srand(); print 1+int(rand() * $threads_max) }" < /dev/null)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user