Skip to main content

n_of_m_eval

Function n_of_m_eval 

Source
pub fn n_of_m_eval(input: u64, n: u64, m: u64) -> u64
Expand description

Core n-of-m evaluation: hash the input’s position within its window and check whether its rank falls within the selected n.

Algorithm: within each window of m consecutive inputs, hash each position (0..m) and sort by hash. The n positions with the smallest hashes are selected. To avoid sorting at runtime, we count how many of the m positions hash lower than the current one — if fewer than n do, this position is selected.