Hello, I would like to use a random number generator for my programs. The problem is, a pseudo-random number generator needs something to start from (seed value) and I was wondering what could be very simple (and cheap) source of very random values. Digital thermometer connected to digital pin? Or perhaps I could wire up a potentiometer which I adjust everytime by hand? (I don't run the sketches 100x a second). Something else?
maybe a photocell? I dunno
two pseudo random numbers? One to be the seed for the second? You could make the first a huge range :P..
Computer programs often use cpu clock time as a seed, as it is unlikely that the user will invoke the same program at the exact same cpu clock time.
Some ideas: - Use millis() as the seed. Run a few tests and see what kind of variation you get. - If you have a real time clock onboard, run some math on the date and use it as the seed value. - In void setup(), read a specific eeprom location and use the number found here as the seed value. Now generate a new number and store it in the eeprom location so that the next time your device is powered on, it can get a new seed.]
Thanks for the feedback! There are some pseudo-random generators  which have very long period so writing the last number of a run into EEPROM could really be an option.  http://en.wikipedia.org/wiki/Mersenne_twister
two pseudo random numbers? One to be the seed for the second?
That always produces the same values, think about it. You are always seeing it with the same number.
Using the millis() counter to time some user input is normally my favourite method.