
First, the number of 1s and 0 s is almost equal (eight 1s and seven 0 s is as close as we can get to equally likely with a sequence of length 15). The sequence generated by our LFSR does possess several desirable properties. If we are interested in generating longer sequences, we could construct a shift register with more stages so that the period of the resulting sequence would be sufficiently long so that its periodicity would not be of concern.
#Binary sequences generator
While periodicity is not a desirable property for a pseudorandom number generator, if we are interested in generating short sequences (of length less than 15 bits), then the periodicity of this sequence generator would not come into play. If the shift register were clocked longer, it would become apparent that the output sequence would be periodic with a period of 15 bits. For example, in addition to having the various bits in the sequence be statistically independent, we might also want 0 s and 1s to be equally likely. So, to simulate an IID sequence of random variables, essentially we would like to create a computer program that will output a binary sequence with the desired statistical properties. Therefore, we seek to assign this task to a computer.

If our application demanded a sequence of length 1 million, not many of us would have the patience to flip the coin that many times. One drawback to this approach is that it is very time consuming. One way to do this would be to grab a coin and start flipping it and observe the sequence of heads and tails, which could then be mapped to a sequence of 1s and 0 s. To start with, suppose we would like to simulate a sequence of independent identically distributed (IID) Bernoulli random variables, X 1, X 2, X 3, …. Miller, Donald Childers, in Probability and Random Processes (Second Edition), 2012 12.1.1 Binary Pseudorandom Number Generators For a sequence of k patients, we can calculate the ratio D k of probabilities for any particular sequence of outcomes using For the first patient, the ratio of probabilities that complications occur is, P(1|H 1)/ P(1|H 0) = 0.10/0.25 = 0.4 the ratio of probabilities that complications do not occur is, / = 0.90/0.75 = 1.2. The sequential test's decision statistic, say, D, is based on the following ratio: the likelihood of H 1 being true divided by the likelihood of H 0 being true for a given sequence of observations.

As usual, we assign α, the risk of accepting H 1 when H 0 is true, and β, the risk of accepting H 0 when H 1 is true. The probability of a complication is 0.25 if H 0 is true, or P(1|H 0) = 0.25. We record 1 as the outcome when a complication appears and 0 when it does not. We pose H 0: the complication rate of the new surgery is still 0.25, and H 1: the new rate is 0.10. Now suppose we are studying a new type of surgery that we believe to have the lower complication rate 0.10. There have been some improvements on the Berlekamp–Massey algorithm, and we cite here Shoup’s book, which contains such an improvement. The running time of the Berlekamp–Massey algorithm is O ( n 2 ) bit operations, where n is the length of the binary sequence s n whose linear complexity is sought. It is interesting to note that if the linear complexity of s n is L ≤ n / 2, then there is a unique LFSR that generates s n of length L.

Let m be the largest integer N / 2, and L ′ = N + 1 − L, if L ≤ N / 2. The LFSR of feedback polynomial C ( x ) also generates s N + 1 = s 0, s 1, …, s N, s N + 1 if and only if the next discrepancy d N is 0. Let s n be a finite binary sequence of linear complexity L = L ( s n ), and C ( x ) be the feedback polynomial of an LFSR which generates s n. The Berlekamp–Massey algorithm is based on the next result.
