mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
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:
parent
887b53b7f3
commit
6bbb0a6b48
3 changed files with 23 additions and 5 deletions
|
@ -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))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue