This question already has an answer here:
- Getting a truly random number in Arduino 4 answers
I need a souce of randomness to generate a seed to pass to
randomSeed. Where can I get this randomness from?
Well, I hear I can read random noise from an unconnected pin.
But I need to connect 9 LEDs and 9 buttons to the board. There seem to be enough pins for this purpose: digital pins 2-13 + analog pins 0-5 makes a total of 18 pins. But does this leave any free pin for a source of randomness?
There are digital pins 0 and 1 left free but I'm reading these should be left free if the board's USB socket is connected and I'm planning to power the whole device by connecting it to a computer through USB. Does this mean I'm supposed to just left pins 0 and 1 unconnected or is it also forbidden to read noise from them?
Or are there any other available sources of randomness? Can I use any other pins for this purpose?
I remember when I was showing this project to the instructor I specifically asked if I have enough pins, noting that I need a source of randomness in addition to 9 LEDs and 9 buttons. He said there are enough pins. Only sadly I forgot to ask how can I read random noise then...
What are my options to somehow obtain a random seed?