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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//! Tiny non-cryptographic RNG, used for DHCP transaction IDs and randomised
//! MAC addresses. Security-sensitive code lives in feature modules and uses
//! audited crates (`rand_core` + `getrandom`).
//!
//! The state is a per-thread xorshift64 seeded from the system clock and a
//! process-global counter, mixed with the thread ID. That is sufficient for
//! "should not collide" use cases like xids and stub MACs; it is not
//! suitable for cryptography.
use Cell;
use ;
use ;
static GLOBAL: AtomicU64 = new;
thread_local!
/// Return a `u32` of non-crypto random bits.
/// Used by DHCP (xid) and vclient (DNS id); unused under some feature sets.
/// Return a `u64` of non-crypto random bits.
/// Fill `buf` with non-crypto random bytes.