Skip to main content
Rmajj.1
Associate II
July 20, 2020
Question

i am using stm32f401re, can i use random number generate function or is there any alternative way

  • July 20, 2020
  • 1 reply
  • 2089 views

..

This topic has been closed for replies.

1 reply

KnarfB
Super User
July 20, 2020

> can i use random number generate function or is there any alternative way

The stm32f401re doesn't have true random generator hardware (RNG or TRNG) on chip which can be used for some crypto algortihms. There is an app note AN4230 Application note telling you more about RNG.

The C-library rand() function is a pure software pseudo-random number generator (PRNG). It will generate the same pseudo-random number sequence after each reset. You can circumvent that by calling seed with some entropy (RTC + 96 bit unique chip ID ...). The actual implementation of rand is not standardized. Its quality may vary as there is a tradeoff between quality and speed. There are better software PRNGs around.

Rmajj.1
Rmajj.1Author
Associate II
July 20, 2020

thank you knarfb

but by calling seed.when reset agian we are getting same sequence of random number.