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
use RngCore;
use Xoshiro256StarStar;
const TWO_POW_62: f32 = 4_611_686_018_427_387_904.0;
/// Threshold on [`uniform_draw`] that is accepted with probability `p`.
///
/// `uniform_draw(rng) < threshold(p)` holds with probability `p` to within 2^-62, so
/// rare moves keep their tiny rates instead of the 2^-24 floor of a 24-bit uniform.
/// The i64 scale keeps the float conversion to one signed instruction on x86-64.
pub
/// [`threshold`] for a probability held in f64.
pub
/// Uniform integer in [0, 2^62) from one RNG step.
pub
/// Uniform in [0, 1] with f32 relative precision at every magnitude, so ln(u) has no
/// 2^-24 floor (u = 0 occurs with probability 2^-62).
pub