> >>The hack to keep it from locking, also shortens the sequence. :( > >It shouldn't unless the sequence generator (bits that are xor'd) is >wrong. Normal operation will not allow the register to shift to all zero >unless it starts at all zero. 'swhat I said. >An important point not mentioned in the description is that each call to >"random" only gennerates one new psuedo-random bit. If you use more than >one bit of the registers as the result, the resulting numbers will be >correlated to each other. For example, if you use the low 3 bits and a >value of 011 occurs, the next value can only be 110 or 111. To prevent >this, call "random" n times, then isolate n bits fromt he register to use >as your random number. I implemented it as running as the least important task, merrily spinning away with an unpredictable number of shifts between uses. For my purpose it was "random" enough. One could take bits from various places and invert some of them, and make them out of order, as long as the number of bits you take is significantly less than the length of the register it should be pretty hard to predict, if that's your goal.