Skip to content

Instantly share code, notes, and snippets.

@DavidObando
Last active August 18, 2016 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidObando/294ba2eeac96885ba9e1499cccbbea96 to your computer and use it in GitHub Desktop.
Save DavidObando/294ba2eeac96885ba9e1499cccbbea96 to your computer and use it in GitHub Desktop.
public class LFSR
{
int _n;
// provide seed value which determines the sequence
public LFSR(int n)
{
_n = n;
}
public int Next()
{
_n = _n >> 1 | (((_n ^ (_n >> 3)) & 1) << 15);
return _n;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment