MCPcopy Create free account
hub / github.com/alceal/plotlars / pseudo_jitter

Function pseudo_jitter

crates/plotlars-plotters/src/render/boxplot.rs:547–550  ·  view source on GitHub ↗

Deterministic pseudo-random jitter from value index. Determinism matters so SVG output is byte-stable across runs (relied on by integration tests). `2654435761` is Knuth's multiplicative-hash constant (golden-ratio integer).

(index: usize, jitter_amount: f64)

Source from the content-addressed store, hash-verified

545/// SVG output is byte-stable across runs (relied on by integration tests).
546/// `2654435761` is Knuth's multiplicative-hash constant (golden-ratio integer).
547fn pseudo_jitter(index: usize, jitter_amount: f64) -> f64 {
548 let hash = (index as u32).wrapping_mul(2654435761) as f64 / u32::MAX as f64;
549 (hash - 0.5) * 2.0 * jitter_amount
550}

Callers 2

draw_boxes_verticalFunction · 0.85
draw_boxes_horizontalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected