Page 1 of 1

random number generator seed

Posted: Thu Aug 07, 2014 4:03 am
by yushanh
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

Re: random number generator seed

Posted: Thu Aug 07, 2014 9:40 am
by Giovanni
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