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:
Jon Siwek 2020-07-22 09:35:50 -07:00
parent 6bbb0a6b48
commit bde38893ce
7 changed files with 23 additions and 10 deletions

View file

@ -45,10 +45,10 @@ std::string Foo::RandomString(const int len)
"abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < len; ++i)
// bro_random is not thread-safe; as we are only using one simultaneous thread
// zeek::random_number() is not thread-safe; as we are only using one simultaneous thread
// here, this should not matter in this case. If this test ever starts showing
// random errors, this might be the culprit.
s[i] = values[bro_random() / (RAND_MAX / sizeof(values))];
s[i] = values[zeek::random_number() / (RAND_MAX / sizeof(values))];
return s;
}