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:
Jon Siwek 2012-06-29 16:24:31 -05:00
parent 0e48fda6ff
commit 34ead91f99
7 changed files with 45 additions and 22 deletions

View file

@ -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.