1 #[cfg(any(feature = "v4", feature = "v7"))]
bytes() -> [u8; 16]2 pub(crate) fn bytes() -> [u8; 16] {
3     #[cfg(not(feature = "fast-rng"))]
4     {
5         let mut bytes = [0u8; 16];
6 
7         getrandom::getrandom(&mut bytes).unwrap_or_else(|err| {
8             // NB: getrandom::Error has no source; this is adequate display
9             panic!("could not retrieve random bytes for uuid: {}", err)
10         });
11 
12         bytes
13     }
14 
15     #[cfg(feature = "fast-rng")]
16     {
17         rand::random()
18     }
19 }
20 
21 #[cfg(any(feature = "v1", feature = "v6"))]
u16() -> u1622 pub(crate) fn u16() -> u16 {
23     #[cfg(not(feature = "fast-rng"))]
24     {
25         let mut bytes = [0u8; 2];
26 
27         getrandom::getrandom(&mut bytes).unwrap_or_else(|err| {
28             // NB: getrandom::Error has no source; this is adequate display
29             panic!("could not retrieve random bytes for uuid: {}", err)
30         });
31 
32         ((bytes[0] as u16) << 8) | (bytes[1] as u16)
33     }
34 
35     #[cfg(feature = "fast-rng")]
36     {
37         rand::random()
38     }
39 }
40