Steve Hardy wrote: > > > From: robin bussell > > > > > >on the chip. What i'm looking for is a *TRUE* random number generator (that > > > >is, as true as posible!) > > > > Thanks in advance. > > > > > If you're using a pic with A/D conversion capabilities then the best > > you can do is > > to hook up a reverse biased diode as a noise source and sample it when > > you need > > a random number.. that way they end up proper quantum physics type > > random! > > ... or if you don't have ADC, try timing the interval between two > geiger counter pulses (cosmic rays will do, no need for radioactive > material). > > Regarding diodes as noise sources, this should be a zener diode in > reverse breakdown, or a transistor BE junction in same condition > (about 8V typically). > > For true uniform distribution, the output of the above techniques > should be fed into a polynomial generator, as in CRC generator, or into > a linear congruential generator i.e. r = r*a + b. See Knuth, > Seminumerical Algorithms, for more details. Merely sampling the level > of white noise will give you more or less Gaussian distribution. > Sampling geiger counter intervals will give Poisson distribution, > I think (my memory of uni physics is fading fast). > > Regards, > SJH > Canberra, Australia Here's the easiest way. You can do it in hardware or software. Although it is not *truly* random, it is quite good indeed : Take a shift register (the longer the better), and tap two or three of the stages. Add the taps (discard the carry - it is the same as XORing) and feed back into the input of the shift register. -- Friendly Regards Tjaart van der Walt mailto:tjaart@wasp.co.za _____________________________________________________________ | Another sun-deprived R&D Engineer slaving away in a dungeon | | WASP International http://wasp.co.za | | GSM and GPS value-added applications | | Voice : +27-(0)11-622-8686 | Fax : +27-(0)11-622-8686 | |_____________________________________________________________|