High-performance generic segment tree and lazy segment tree implementations in Rust for efficient range queries, range updates, and interval operations. Supports custom monoid operations with zero-cost abstractions.
/// A tiny deterministic linear congruential generator so we don't need external crates.
/// Not cryptographically secure — only for reproducible pseudo-random inputs in benchmarks.
#[derive(Clone)]pubstructLcg(u64);implLcg{pubfnnew(seed:u64)->Self{Self(seed)}pubfnnext_u64(&mutself)->u64{// Parameters from Numerical Recipes (common LCG)
self.0=self.0.wrapping_mul(6364136223846793005).wrapping_add(1442695040888963407);self.0}pubfnnext_usize(&mutself, max:usize)->usize{(self.next_u64()asusize)% max
}}