Closed rifatmahmud closed 8 years ago
If you want a random number you can get it from the softdevice call to the RNG hardware. See https://devzone.nordicsemi.com/question/7244/random-pool-numbers-documentation/ for a bit more detail. Will that work for you ?
Ok, but just wondering, what rand library in rbc mesh is for? Can I use that, getting the seed from timer or rtc?
You can seed the prng with rand_prng_seed(), which seeds from the SD-pool (hardware rng). The prng is based on Bob Jenkins' small PRNG, which has decent cycles and uniformness, but it's not suited for cryptographic purposes. You can also use the rand_hw_rng_get()
for accessing the sd_rand, but you could also use the SD interface directly.
How to randomly change the seed in this function while generating random number? uint32_t rand_prng_seed(prng_t* p_prng);