Go Down

Topic: Using analogRead() on floating pin for random number generator seeding/generator (Read 3 times) previous topic - next topic

srinathdevelopment

Ardgrafix6100 - A fast, full-featured Arduino graphics driver for Nokia 6100 LCDs http://code.google.com/p/ardgrafix6100/

benediktkr

You are entirely correct. I did extensive research on this and essentially debunked this claim made by Arduino. I did not find a stable and viable way to generate randomness on-board the Arduino.

See the full paper here: http://benedikt.sudo.is/ardrand.pdf

fungus


Results
99.5% of the 1 million values were distributed between just 38 values out of 1024 possible values. Hmmm.... does not seem to be a wide "seed" range by any means :(

Comments / Thoughts welcome.



That's what cryptographers use hash functions for - take a sample of the bottom bits of the values and put them through a hash function (CRC32, MD5...whatever size you need).
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

dhenry

Quote
I did extensive research on this and essentially debunked this claim made by Arduino.


Take a look at this thread:

http://arduino.cc/forum/index.php/topic,133261.0.html

The stock analogRead() is essentially incorrectly coded.

I did a Chi-squared test on about 7k data points and it passed with flying color using the revised myanalogRead() provided in that thread. The distribution is also quite uniform.

It also talked about other ways to potentially produce truly random numbers from your arduino. The rc oscillator approach for example can be done with just a resistor + cap + onboard comparator.

The ideal is solid, except it is incorrectly implemented.

Coding Badly

I did a Chi-squared test on about 7k data points and it passed with flying color using the revised myanalogRead() provided in that thread. The distribution is also quite uniform.


So did I.  The result was a spectacular failure.

Go Up