Deprecate bro_prng(), replace with zeek::prng()

The type used for storing the state of the RNG is changed from
`unsigned int` to `long int` since the former has a minimal range
of [0, 65,535] while the RNG function itself has a range of
[1, 2147483646].  A `long int` must be capable of
[−2147483647, +2147483647] and is also the return type of `random()`,
which is what zeek::prng() aims to roughly parity.
This commit is contained in:
Jon Siwek 2020-07-22 09:13:34 -07:00
parent 887b53b7f3
commit 6bbb0a6b48
3 changed files with 23 additions and 5 deletions

View file

@ -119,7 +119,7 @@ DefaultHasher::DefaultHasher(size_t k, Hasher::seed_t seed)
for ( size_t i = 1; i <= k; ++i )
{
seed_t s = Seed();
s.h[0] += bro_prng(i);
s.h[0] += zeek::prng(i);
hash_functions.push_back(UHF(s));
}
}
@ -149,7 +149,7 @@ bool DefaultHasher::Equals(const Hasher* other) const
}
DoubleHasher::DoubleHasher(size_t k, seed_t seed)
: Hasher(k, seed), h1(seed + bro_prng(1)), h2(seed + bro_prng(2))
: Hasher(k, seed), h1(seed + zeek::prng(1)), h2(seed + zeek::prng(2))
{
}