On Mon, 5 Jan 1998 10:40:33 -0500 Tom Sgouros writes: >Ok then, how about a hardware way to make the seed? I would like a >slightly higher quality random number generator than I can get by >putting the seed in ROM. If the project has asyncronous external inputs such as a user pressing buttons or data from an external source, the exact time they arrive will be pretty much random. If not, the value in RAM at power-on is somewhat random from chip to chip, but probably very consistent for a particular chip. The exact time the WDT expires is not synchronized with the PIC clock. Set the WDT for maximum duration and increment a counter as fast as possible until it is stopped by the WDT expiring. The value in the low few bits of the counter should be rather random. Using the WDT, it can take several seconds to collect the 20 or 30 bits to make a good seed mumber. Maybe this could be the primary random generator in the random interval generator though. Using the WDT as the primary timebase, the distribution of interval times will shift with temperature, voltage, etc. Use all the bits of the counter to correct for this by computing the number of WDT timeouts per minute, multiply by the (random) number of minutes desired, and count down. >-tom > >---------------------------------------------------------------------- >tomss at ids.net - 401-861-2831 - 42 Forge Rd, Potowomut, RI 02818 USA >