In ruiTop.h
the void randomSeed(unsigned long seed);
function is described thus:
randomSeed() initializes the pseudo-random number generator, causing it to start at an arbitrary point in its random sequence. This sequence, while very long, and random, is always the same.
Which means this is not random. Considering that the SX1262 has a TRNG functionality, it would be much safer – and simpler – to build the sequence on the fly from the RANDOM_NUMBER_GENERATORBASEADDR
register of the SX1262. And when you reach the end, just refill. See Sx1262LoRandom for an example of how it’s done. There may even be, ahem, a similar proposal in Jira, for all I know…
FWIW, the nRF52040 also has TRNG through its CC310 module – yes, there’s code available too – but using the SX1262 would be cross-platform.
And this would be the perfect case to add readRegister()
/ writeRegister()
functions to the API, so that users can take advantage of functionalities not present in the API…