cmv

Crates.iocmv
lib.rscmv
version0.1.0
created_at2025-07-16 15:20:06.995461+00
updated_at2025-07-16 15:20:06.995461+00
descriptionRust implementation of 'Distinct Elements in Streams: An Algorithm for the (Text) Book' by Sourav Chakraborty et al.
homepage
repositoryhttps://github.com/romac/cmv
max_upload_size
id1755650
size235,725
Romain Ruetschi (romac)

documentation

README

cmv

Crates.io Version Crates.io License Crates.io MSRV

Rust implementation of Distinct Elements in Streams: An Algorithm for the (Text) Book by S. Chakraborty, K. Meel, N. V. Vinodchandran.

Usage

use rand::SeedableRng;
use rand::rngs::SmallRng;

use cmv::Cmv;

fn estimate_distinct(words: &[&str]) -> u128 {
      let mut rng = SmallRng::seed_from_u64(0x123456789);
      let mut cmv = Cmv::with_capacity(128);

      for &word in words.iter() {
          cmv.insert(word, &mut rng);
      }

      cmv.count()
}

License

Licensed under the Apache 2.0 license.

Commit count: 0

cargo fmt