mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 20:18:20 +00:00
GH-1076: Fix bro_srandom() to replace 0 seeds with 1
The bro_prng() implementation cannot generate 0 as a result since it causes every subsequent number from the PRNG to also be 0, so use the number 1 instead of 0.
This commit is contained in:
parent
0f4eb9af02
commit
887b53b7f3
3 changed files with 11 additions and 2 deletions
6
testing/btest/Baseline/bifs.rand/out.4
Normal file
6
testing/btest/Baseline/bifs.rand/out.4
Normal file
|
@ -0,0 +1,6 @@
|
|||
0
|
||||
131
|
||||
755
|
||||
4
|
||||
634
|
||||
473
|
|
@ -2,9 +2,12 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: zeek -b %INPUT do_seed=F >out.2
|
||||
# @TEST-EXEC: unset ZEEK_SEED_FILE && zeek -b %INPUT real_random=T >out.3
|
||||
# @TEST-EXEC: for i in $(seq 21); do echo 0 >>random-zero.seed; done
|
||||
# @TEST-EXEC: ZEEK_SEED_FILE=random-zero.seed zeek -b %INPUT >out.4
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff out.2
|
||||
# @TEST-EXEC: btest-diff out.3
|
||||
# @TEST-EXEC: btest-diff out.4
|
||||
|
||||
const do_seed = T &redef;
|
||||
const real_random = F &redef;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue