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
//! RNG based on the `wyrand` pseudorandom number generator.
//!
//! This crate uses the random number generator for exactly two things:
//!
//! * Generating DevNonces for join requests
//! * Selecting random channels when transmitting uplinks.
//!
//! The good news is that both these operations don't require true
//! cryptographic randomness. In fact, in both cases, we don't even care about
//! predictability! A pseudorandom number generator initialized with a seed
//! generated by a true random number generator is plenty enough:
//!
//! * DevNonces must only be unique with a low chance of collision.
//! The 1.0.4 LoRaWAN spec even explicitly requires the DevNonces to be
//! a sequence of incrementing integers, which is obviously predictable.
//! * No one cares if the channel selected for the next uplink is predictable,
//! as long as the channel selection yields an uniform distribution.
//!
//! By providing a PRNG `RngCore` implementation, we enable the crate users the
//! flexibility of choosing whether they want to provide their own RNG, or just
//! a seed to instantiate this PRNG to generate the random numbers for them.
use Rng;
use RngCore;
/// A pseudorandom number generator utilizing Wyrand algorithm via
/// the `fastrand` crate.
;