mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 08:38:20 +00:00
Deprecate bro_random(), replace with zeek::random_number()
Avoiding the use of zeek::random() due to potential for confusion with random().
This commit is contained in:
parent
6bbb0a6b48
commit
bde38893ce
7 changed files with 23 additions and 10 deletions
10
src/util.h
10
src/util.h
|
@ -202,7 +202,7 @@ extern std::string strstrip(std::string s);
|
|||
extern void hmac_md5(size_t size, const unsigned char* bytes,
|
||||
unsigned char digest[16]);
|
||||
|
||||
// Initializes RNGs for bro_random() and MD5 usage. If load_file is given,
|
||||
// Initializes RNGs for zeek::random_number() and MD5 usage. If load_file is given,
|
||||
// the seeds (both random & MD5) are loaded from that file. This takes
|
||||
// precedence over the "use_empty_seeds" argument, which just
|
||||
// zero-initializes all seed values. If write_file is given, the seeds are
|
||||
|
@ -225,6 +225,7 @@ unsigned int bro_prng(unsigned int state);
|
|||
|
||||
// Replacement for the system random(), to which is normally falls back
|
||||
// except when a seed has been given. In that case, the function bro_prng.
|
||||
[[deprecated("Remove in v4.1. Use zeek::random_number()")]]
|
||||
long int bro_random();
|
||||
|
||||
// Calls the system srandom() function with the given seed if not running
|
||||
|
@ -599,4 +600,11 @@ void set_thread_name(const char* name, pthread_t tid = pthread_self());
|
|||
*/
|
||||
long int prng(long int state);
|
||||
|
||||
/**
|
||||
* Wrapper for system random() in the default case, but when running in
|
||||
* deterministic mode, uses the platform-independent zeek::prng()
|
||||
* to obtain consistent results since implementations of rand() may vary.
|
||||
*/
|
||||
long int random_number();
|
||||
|
||||
} // namespace zeek
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue