Generate true random numbers on microcontroller

Sometimes there is really a problem of how to generate truly random numbers using your microcontroller. Usually, a computer processor or any other MCU can generate a Pseudo-Random Number (PRN). These numbers are generated by algorithms, so-called Pseudo-Random Number Generators (PRNG). Everything that a pure algorithm produces is predictable at some level. Many PRNG algorithms generate random numbers, but there is always a defined number of iterations when a random number sequence will repeat itself. Sometimes it may be acceptable. One popular way to generate pseudo-random numbers is using Timers. The universal algorithm is the concept of the Linear Feedback Shift Register (LFSR). LSFR is an n -bit register initiated with a non-zero seed value and is clocked by shifting values to the left and loading a new bit into bit0. The new bit is calculated by XORing the bits of selected taps of LSFR. This method is used in rand() functions.