Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Linear-feedback shift register
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Example in Python === A sample python implementation of a similar (16 bit taps at [16,15,13,4]) Fibonacci LFSR would be {{clear}} <syntaxhighlight lang="python"> start_state = 1 << 15 | 1 lfsr = start_state period = 0 while True: # taps: 16 15 13 4; feedback polynomial: x^16 + x^15 + x^13 + x^4 + 1 bit = (lfsr ^ (lfsr >> 1) ^ (lfsr >> 3) ^ (lfsr >> 12)) & 1 lfsr = (lfsr >> 1) | (bit << 15) period += 1 if lfsr == start_state: print(period) break </syntaxhighlight> Where a register of 16 bits is used and the xor tap at the fourth, 13th, 15th and sixteenth bit establishes a maximum sequence length.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)