Hi all,
I've seen many discussions talking about random number and wonder which solution would be the best? The solution I came up with is using halGetCounterValue() as the srand seed, and it looks functioning pretty well. Any suggestions?
By the way, I use STM32L. No hardware RNG.
Thanks,
Shan
random number generator seed
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: random number generator seed
Hi,
An HW counter has problems as a random numbers generator because it is synchronous with the system clock.
You should try to use some counter driven by the internal IRC oscillator, that would work better. I don't know if it is possible to drive some timers using it, you should verify that.
Giovanni
An HW counter has problems as a random numbers generator because it is synchronous with the system clock.
You should try to use some counter driven by the internal IRC oscillator, that would work better. I don't know if it is possible to drive some timers using it, you should verify that.
Giovanni