This is the code I've got so far: function = lfsr(limit, init, tap) Suppose I need to generate a sequence from 1 to 16,384 (2^14) in random order, my initial state is number 329 and the tap is 7. I'm trying to code my own implementation of Linear Feedback Shift Register on Matlab in order to generate a pseudo-random sequence of numbers.