Electronic – Random number generators using a GPIO pin

floating-pinmicrocontrollerrandom number

I just read through question AVR Random Number Generator and encountered a number of ways to generate random seeds in an AVR:

  • Use a special-purpose "Secure AVR"
  • Use an internal temperature sensor
  • Read unwritten EEPROM
  • Measure time intervals between user input
  • Use a floating ADC pin.

Why not just a single digital pin, configured as input without pull-up and floating? In theory that should generate a stream of random bits. Why not use this? Is the state too slowly changing? Does it tend to stuck at 1 or 0? Any other problems?

Best Answer

"Random" is a tricky word. In some contexts, it simply means "unpredictable", but in other contexts — in particular, the ones associated with signal processing and cryptography — it means "statistically uncorrelated".

Even if the value read from a floating pin is unpredictable ("random" in the first sense), it is not likely to be useful in the second sense.