Skip to main content

batch_process_nonce

Function batch_process_nonce 

Source
pub fn batch_process_nonce() -> u64
Expand description

Per-process nonce used by Batch::process_nonce. Sampled once (lazy) from a mix of entropy sources so two processes launched on the same machine within a single nanosecond tick are still distinguishable.

We don’t use getrandom here because it’s a feature-gated optional dep — event.rs is in the always-compiled core. Instead we run xxh3 over multiple sources whose joint state is effectively never identical across two adjacent process starts: wall-clock nanos, monotonic-clock nanos (resilient to wall-clock skew), pid, the address of a stack-local (gives an ASLR component), and the current thread id. Plain XOR of two sources (the previous implementation) collapses to zero whenever the components happen to share bit patterns; xxh3 mixes them so any single non-degenerate source dominates the output.