mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 09:08:20 +00:00
Fix inconsistencies in random number generation.
The srand()/rand() interface was being intermixed with the srandom()/random() one. The later is now used throughout. Changed the srand() and rand() BIFs to work deterministically if Bro was given a seed file (addresses #825). They also now wrap the system's srandom() and random() instead of srand() and rand() as per the above.
This commit is contained in:
parent
0e48fda6ff
commit
34ead91f99
7 changed files with 45 additions and 22 deletions
|
@ -159,6 +159,10 @@ extern bool have_random_seed();
|
|||
// predictable PRNG.
|
||||
long int bro_random();
|
||||
|
||||
// Calls the system srandom() function with the given seed if not running
|
||||
// in deterministic mode, else it updates the state of the deterministic PRNG
|
||||
void bro_srandom(unsigned int seed);
|
||||
|
||||
extern uint64 rand64bit();
|
||||
|
||||
// Each event source that may generate events gets an internally unique ID.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue