diff options
author | Ron Yorston <rmy@pobox.com> | 2023-01-11 08:13:53 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-01-11 08:13:53 +0000 |
commit | 67fb94dea61e74da032a8f0c51fbf216ec47dadb (patch) | |
tree | f832391ba28642e38fe848cd8e7684fdb3e85148 /runit | |
parent | 6a61981e0480b8a469d9d4b84ea27a9ec1d2b8d9 (diff) | |
download | busybox-w32-67fb94dea61e74da032a8f0c51fbf216ec47dadb.tar.gz busybox-w32-67fb94dea61e74da032a8f0c51fbf216ec47dadb.tar.bz2 busybox-w32-67fb94dea61e74da032a8f0c51fbf216ec47dadb.zip |
awk: further improvements to randomness
POSIX requires that the awk srand() function uses the time of day
to seed the PRNG. The obvious implementation used in BusyBox does
exactly that, passing time(NULL) to srand(3).
When processes are started within a few seconds of one another their
seeds are very similar. Given the realtively poor quality of rand(3)
in some C runtimes this results in random number sequences that are
somewhat correlated.
Improve matters by using an integer hash on the seed, as recommended
here:
https://nullprogram.com/blog/2019/04/30/#the-wrong-places
Costs 48 bytes.
(GitHub issue #279)
Diffstat (limited to 'runit')
0 files changed, 0 insertions, 0 deletions