···1414// generate 1 million 7-digit random positive integers
1515fn generate_random_numbers() -> Vec<i32> {
1616 let mut rng = thread_rng();
1717- let numbers = (0..1_000_000)
1717+1818+ (0..1_000_000)
1819 .map(|_| rng.gen_range(1_000_000..10_000_000))
1919- .collect();
2020- numbers
2020+ .collect()
2121}
22222323fn open_file<P>(filename: P) -> BufReader<File>
···3939#[allow(unused_must_use)]
4040fn bench_count_strings_integers(c: &mut Criterion) {
4141 c.bench_function(
4242- &format!("Count unique strings in The King in Yellow with regex regularization: e = 0.8, d = 0.1, s = 1000"),
4242+ "Count unique strings in The King in Yellow with regex regularization: e = 0.8, d = 0.1, s = 1000",
4343 |b| {
4444 let input_file = "benches/kiy.txt";
4545 let epsilon = 0.8;
···5656 },
5757 );
5858 c.bench_function(
5959- &format!("Count uniques in ten million 7-digit random positive integers: e = 0.8, d = 0.1, s = 1000"),
5959+ "Count uniques in ten million 7-digit random positive integers: e = 0.8, d = 0.1, s = 1000",
6060 |b| {
6161 let epsilon = 0.8;
6262 let delta = 0.1;
+1-1
src/lib.rs
···4848 // Round 0: if an element exists, remove it. Element is added back due to probability 1
4949 // When buffer is full, remove half the elements
5050 // Round 1: if an element exists, remove it. Element MAY be added back due to probability 0.5
5151- if self.buf.get(&elem).is_some() {
5151+ if self.buf.contains(&elem) {
5252 self.buf.remove(&elem);
5353 }
5454 if self.rng.gen_bool(self.probability) {