PRBS array C code generator (pretty nasty)

Needed an 11 bit PRBS (Pseudo Random Binary Sequence) for use in a project. After some searching online, I came across this sweet wikipedia article on Linear Feedback Shift Registers (LFSRs). This article includes some sample C code to generate a PRBS sequence so I modified this code to generate a sequence that is 2048 bits in length.

This 2048 bit sequence in printed as a sequence of 1s and 0s to a .txt file. It looks something like this:
0010010001110110101101011000110001110111101101010010110000110011100111111011110000101001100100011111101……you get the idea

Fairly useless in its current state so some Python magic is required to convert this in to C code.

So its just an array definition that can be conveniently hidden away in a header file. There’s a github repo called prbs_C_gen with all of the source files and example output files if you fancy taking a peek.