···
8
8
keywords = ["CVM", "count-distinct", "estimation"]
9
9
categories = ["algorithms", ]
10
10
11
11
-
version = "0.1.11"
11
11
+
version = "0.2.0"
12
12
edition = "2021"
13
13
14
14
[dependencies]
···
1
1
//! An implementation of the CVM fast element counting algorithm presented in
2
2
//! Chakraborty, S., Vinodchandran, N. V., & Meel, K. S. (2022). *Distinct Elements in Streams: An Algorithm for the (Text) Book*. 6 pages, 727571 bytes. <https://doi.org/10.4230/LIPIcs.ESA.2022.34>
3
3
4
4
-
use rand::rngs::ThreadRng;
5
5
-
use rand::Rng;
4
4
+
use rand::rngs::StdRng;
5
5
+
use rand::{Rng, SeedableRng};
6
6
7
7
use rustc_hash::FxHashSet;
8
8
use std::hash::Hash;
···
14
14
buf_size: usize,
15
15
buf: FxHashSet<T>,
16
16
probability: f64,
17
17
-
rng: ThreadRng,
17
17
+
rng: StdRng,
18
18
}
19
19
20
20
impl<T: PartialEq + Eq + Hash> CVM<T> {
···
38
38
buf_size: bufsize,
39
39
buf: FxHashSet::with_capacity_and_hasher(bufsize, Default::default()),
40
40
probability: 1.0,
41
41
-
rng: rand::thread_rng(),
41
41
+
rng: StdRng::from_entropy(),
42
42
}
43
43
}
44
44
/// Add an element, potentially updating the unique element count