Good source of random numbers?

The documentation on random() and randomSeed() suggest using the input from an unconnected analog pin, however I suspect this isn't remotely random enough for any serious purposes--you've only got 1024 possible seeds, and probably only about 100 in practice! What do you suggest would be a good source of random data? I'm considering using floating-point operations with a series of trigonometric functions, but would this even work? I could use real-world data, but I'd prefer not to use up any pins.

Americium from a smoke detector and a G-M tube

Any one who considers arithmetical methods of producing random digits is, of course, in a state of sin - John von Neumann

If you really want better randomness, you pretty much have to get it from some external physical source.

You might be interested in this recent discussion:
http://arduino.cc/forum/index.php/topic,108380.0.html

The library mentioned in the previous discussion is available from a link in my signature block. It uses the jitter associated with the watchdog timer and timer 1 to produce what appears so far to be a very random stream of numbers. It only produces about 8 bytes per seconds, but if you need more it can be used to seed a pseudo-random generator, either the one built into the arduino library or perhaps one of the better ones such as blub-blub... In addition that page has information/source on two other hardware based methods for generating random numbers. I have used geiger counters as well as avalanche noise and can provide test results for both if your interested.

AWOL:
Americium from a smoke detector and a G-M tube

The legality of that method seems rather questionable to me.... Besides, I don't have a Geiger-Mueller tube.

Thanks, I'll use that library! Internal jitter is exactly the sort of thing I was looking for.

The legality of that method seems rather questionable to me..

Can't think of a good reason why it should be, unless dismantling a smoke detector is in some way illegal.

AWOL:

The legality of that method seems rather questionable to me..

Can't think of a good reason why it should be, unless dismantling a smoke detector is in some way illegal.

Am-241 is exempt from most laws regarding the safety and handling of radioactive materiel. It depends on your locality, of course, and some locales have laws that say this with the caveat that you can possess it as long as it remains in the smoke detector sold to you untampered.

But in a great number of localities you can even dispose of these smoke detectors in regular household trash. You can eat the pellet w/o really causing yourself significant damage (though, of course, no one is suggesting it is a /good/ idea to do so -- prudence and intelligent behaviour is still the rule.)

The fact is that some types of collectable Fiestaware are more radioactive than the small amount of Am-241 in modern detectors.

But, it is all a matter of degree. If you are going to be a Radioactive Boy Scout, it doesn't matter how legal playing with Am-241 is. A superfund site is a still a superfund site!

wanderson:
It only produces about 8 bytes per seconds, but if you need more it can be used to seed a pseudo-random generator, either the one built into the arduino library

Bah! That one barely qualifies as "random number generator". :wink:

or perhaps one of the better ones such as blub-blub...

JKISS32 (the "J" and "32" are important!) from this paper...

http://www.cs.ucl.ac.uk/staff/d.jones/GoodPracticeRNG.pdf

...is an excellent choice. It is faster, smaller, and much better quality than the AVR Libc generator. The only downside is the extra SRAM needed (20 bytes versus 4).

One of the best generally accepted sources of entropy is the noise generated at the breakdown of a reverse biased zener diode. http://electronicdesign.com/article/test-and-measurement/wide-band-analog-white-noise-generator6356

You can also make reasonable white noise to use as an entropy source by massively amplifying the thermal noise in a resistor using an op-amp.

I suppose, while we're on the topic of noise, one could use the noise produced by a broken component that still erratically conducts? Such as a capacitor that's undergone dielectric breakdown, or a diode that's avalanched one too many times?

A good random firing cell I made in the 60s, consisted of a small tube with some cotton wool soaked in Silver Nitrate solution.

Two electrodes are placed into this.
A voltage across the electrodes causes dendrites of silver to form on the cotton wool. When they join up it causes a short that melts the dendrites and causes a small pulse to be produced. The current is very low, and the time between pulses is random.

xolroc:
I suppose, while we're on the topic of noise, one could use the noise produced by a broken component that still erratically conducts? Such as a capacitor that's undergone dielectric breakdown, or a diode that's avalanched one too many times?

You have to run the test. Things that seem random to us often are not. RANDU and TrueRandom are great examples.

Grumpy_Mike:
A good random firing cell I made in the 60s, consisted of a small tube with some cotton wool soaked in Silver Nitrate solution.

Cool experiment. Unfortunately, it may be a bit expensive these days... SINI-1542-42 25g £29.12

Silver Nitrate Solution, 0.1 M, 100 mL | Flinn Scientific there, one hundred milliliters of 0.1M silver nitrate, for 13.55. I'm sure there are some cheaper ways to do this though.

robtillaart:

I'm afraid I don't have an ethernet shield, so that's not an option!

If finding enough entropy is the only problem, I'm willing to offer my son's bedroom as a useful source.

my son's bedroom

Now there's a source we haven't considered before. Probably the only one left I think.

Note that the Due should finally lay this to rest as the SAM3X has TRNG hardware.


Rob

wildbill:
Any one who considers arithmetical methods of producing random digits is, of course, in a state of sin - John von Neumann

If you really want better randomness, you pretty much have to get it from some external physical source.

It really depends upon what you are using the 'randomness' for. For instance simulation techniques do not usually need true randomness--only something that is close. Something mathematical techniques are usually well suited for. And there are a few mathematical generators that outperform all but the best of the physical sources.
Most true sources of entropy; radioactive DECAY; avalanche noise; Johnson noise; clock jiggered; all require deterministic whitening techniques in order to produce unbiased random numbers. And they are very temperamental. Small changes to their operating environment can severely compromise their performance.

ID Quantique makes the Quantis RNG:

which looks pretty good. The USB-4M module costs 990 €.