1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Jitter: quasirandom offsets that spread coincident points apart.
/// Positions spread by a van der Corput offset: point `i` moves by
/// `(v(i) − ½) · width`, where `v` is the base-2 van der Corput sequence, so
/// a strip of points fills its band evenly instead of clumping the way a
/// random draw would — and there is no seed to forget, so the plot stays a
/// value. Gaps stay gaps.
///
/// The strip beside a box plot, the "rain" of a raincloud: feed the band
/// indices in and hand the result to [`Points::xy`](crate::Points::xy).
///
/// ```
/// let spread = malevich::stat::jitter(&[0.0, 0.0, 0.0, 0.0], 2.0);
/// assert_eq!(spread, [0.0, -0.5, 0.5, -0.75]);
/// ```
/// The base-2 van der Corput sequence at `index`: the binary digits of
/// `index` mirrored across the point.