@@ -121,10 +121,9 @@ fn uint64_to_base10_slice(n: u64) -> Vec<i32> {
121
121
122
122
#[ cfg( test) ]
123
123
mod tests {
124
- use std:: {
125
- collections:: HashMap ,
126
- hash:: { BuildHasher , RandomState } ,
127
- } ;
124
+ use std:: collections:: HashMap ;
125
+
126
+ use ahash:: RandomState ;
128
127
129
128
use super :: CountMinSketch ;
130
129
@@ -135,7 +134,7 @@ mod tests {
135
134
assert_eq ! ( sketch. block_mask, 2047 ) ;
136
135
assert_eq ! ( sketch. sample_size, 163840 ) ;
137
136
138
- let hasher = RandomState :: new ( ) ;
137
+ let hasher = RandomState :: with_seeds ( 9 , 0 , 7 , 2 ) ;
139
138
let mut failed = 0 ;
140
139
for i in 0 ..8000 {
141
140
let key = format ! ( "foo:bar:{}" , i) ;
@@ -172,7 +171,7 @@ mod tests {
172
171
* i = !0 ;
173
172
}
174
173
sketch. additions = 100000 ;
175
- let hasher = RandomState :: new ( ) ;
174
+ let hasher = RandomState :: with_seeds ( 9 , 0 , 7 , 2 ) ;
176
175
let h = hasher. hash_one ( "foo" ) ;
177
176
assert_eq ! ( sketch. estimate( h) , 15 ) ;
178
177
sketch. reset ( ) ;
@@ -188,7 +187,7 @@ mod tests {
188
187
#[ test]
189
188
fn test_sketch_reset_addition ( ) {
190
189
let mut sketch = CountMinSketch :: new ( 500 ) ;
191
- let hasher = RandomState :: new ( ) ;
190
+ let hasher = RandomState :: with_seeds ( 9 , 0 , 7 , 2 ) ;
192
191
let mut counts = HashMap :: new ( ) ;
193
192
for i in 0 ..5 {
194
193
let key = format ! ( "foo:bar:{}" , i) ;
@@ -235,7 +234,7 @@ mod tests {
235
234
#[ test]
236
235
fn test_sketch_heavy_hitters ( ) {
237
236
let mut sketch = CountMinSketch :: new ( 512 ) ;
238
- let hasher = RandomState :: new ( ) ;
237
+ let hasher = RandomState :: with_seeds ( 9 , 0 , 7 , 2 ) ;
239
238
240
239
for i in 100 ..100000 {
241
240
let h = hasher. hash_one ( format ! ( "k:{}" , i) ) ;
0 commit comments