Do you know where your variables are?  
PerlMonks 
Comment on 
( #3333=superdoc: print w/ replies, xml )  Need Help?? 
Here is a bit more on what an LFSR is. A LFSR is a register of N bits. Two or more positions are designated as "taps" and the bit values from those positions are XOR'd together to produce a new bit. This bit is placed to the left of the register and all bits are then shifted to the right with the previous rightmost bit being returned as the output. 4 3 2 1 0 < tap location numbers ++++++ ,> 0  1  0  1  0  > Output  ++++++        `>XOR<'   `<' You repeat this process forever, producing a somewhat random stream of bits as a result. A good LFSR will repeat the pattern of bits produced only after (2**N)1 interations. For each size of LFSR, there are positions for the taps that result in such a "good" LFSR. Unless, of course, you seed it with a value of 0, which will always stay 0 since the XOR of any number of 0 bits is another 0 bit. Note, that is why the period can't be larger than (2**N)1 since there are 2**N possible states and one of them (the value 0) can't be part of the loop. You can go to http://www.google.com/ and search for LFSR to get more information on these. The person who pointed these out to me also pointed me to the book Applied Cryptography. From my quick introduction to these, I'm starting to think that most of the material on them is a bit sloppy. (: It seems to me that if you have an odd number of taps, then either a seed of 0 or of all 1 bits would never change (the XOR of an odd number of 1 bits is another 1 bit). But most of the "good" arrangements of taps have an odd number of taps [ which means that the maximum period for an odd number of taps would be (2**N)2 ]. So I think we should really be using XNOR instead of XOR. Though I'm reluctant to jump to many conclusions since I've just barely learned of them. :)  tye (but my friends call me "Tye")In reply to (tye)Re: LFSR golf
by tye

