mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 12:38:20 +00:00
Make H3 seed configurable.
This commit is contained in:
parent
1f90b539a8
commit
529d120376
1 changed files with 2 additions and 2 deletions
4
src/H3.h
4
src/H3.h
|
@ -65,7 +65,7 @@
|
|||
template<class T, int N> class H3 {
|
||||
T byte_lookup[N][H3_BYTE_RANGE];
|
||||
public:
|
||||
H3()
|
||||
H3(T seed = bro_random())
|
||||
{
|
||||
T bit_lookup[N * CHAR_BIT];
|
||||
|
||||
|
@ -74,7 +74,7 @@ public:
|
|||
bit_lookup[bit] = 0;
|
||||
for ( size_t i = 0; i < sizeof(T)/2; i++ )
|
||||
// assume random() returns at least 16 random bits
|
||||
bit_lookup[bit] = (bit_lookup[bit] << 16) | (bro_random() & 0xFFFF);
|
||||
bit_lookup[bit] = (bit_lookup[bit] << 16) | (seed & 0xFFFF);
|
||||
}
|
||||
|
||||
for ( size_t byte = 0; byte < N; byte++ )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue