fork download
  1. #include <iostream>
  2.  
  3. int LSFR()
  4. {
  5. static unsigned long shift_register = 1;
  6.  
  7. shift_register = ((( (shift_register >> 31)
  8. ^ (shift_register >> 6)
  9. ^ (shift_register >> 4)
  10. ^ (shift_register >> 2)
  11. ^ (shift_register >> 1)
  12. ^ shift_register)
  13. & 0x00000001)
  14. << 31)
  15. | (shift_register >> 1);
  16.  
  17. return shift_register & 0x00000001;
  18. }
  19.  
  20. int main() {
  21.  
  22. for (int i{}; i < 500; i++) std:: cout << LSFR();
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
00000000000000000000000000000001111111111111111111111111101110010101010101010101010011010100101100110011001101100100011100001011101110100101101110111010010001011110011101100101111000110101010000010010000101011000111101001110100100111001110100001101001110000011100001111111001010111100011000100001100001101110101100101111000101100111100010110000101011101110110010001000001000111110100110110110001000111100101001001100101100000011100110000000000000000001011001100111000000000000011100010111000001100000