This function generates a sequence of numbers using a Fibonacci Linear Feedback Shift Register (LFSR). LFSR is a shift register that produces a pseudo-random sequence of binary numbers based on the initial seed value and the feedback configuration.

lfsr_fib(seed, n, bitsize, taps)

Arguments

seed

A large integer (64-bit) representing the initial value of the LFSR.

n

Integer specifying the number of numbers to generate.

bitsize

Integer specifying the number of bits in the LFSR. This determines the register's length.

taps

A numeric vector specifying the tap positions used to calculate the feedback bit. The values should correspond to bit positions (1-based indexing).

Value

A numeric vector containing the sequence of generated numbers from the LFSR.

Details

The function implements a Fibonacci LFSR, where the feedback bit is computed by XOR-ing selected bits (as determined by the tap positions). The register is then shifted, and the feedback bit is inserted into the most significant position.

Examples

lfsr_fib(seed = 12345, n = 1000, bitsize = 16, taps =c(1, 3,4,6))|>
 plot()