> > The problem with the rotate & carry routines is they > repeat, eg after > > 65k operations (16 bit register). > > Tony: > > That property is hardly unique to LFSRs. Since pseudo-random > number generators are deterministic algorithms run on > deterministic machines with finite memory, they ALL repeat. > > -Andrew That's right, which is why I mentioned seeding etc. The algorithm is possibly the least of your worries. Since they repeat, you need some method of jumping around in the sequence. The Basic 'Randomise Timer' was commonly used as the value of TIMER (system clock) would change, so the starting point in the sequence would change. OF course, if the program happened to start at exactly the same time, you get the same sequence of numbers. In a PIC, you'll need to find something like that, typically from the environment. Like Jinx said, maybe the WDT (temperature sensitive). Hook a light detector to an ADC. Measure cycles between keypresses and so on. Personally, having the PRNG run continuously might be the easiest option. No guaranted to be random though. Tony -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist