using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication3
{
class Program
{
static uint[] LFSR(uint reg, int[] shift)
{
uint xor = reg & 1;
uint o = xor;
for (int i = shift.Length - 2; i >= 0; i--)
{
xor ^= (reg >> shift[i]) & 1;
}
reg = reg >> 1 | xor << shift[0];
return new uint[] { o, reg };
}
static void Main(string[] args)
{
uint reg1 = 43949, reg2 = 181, reg3 = 3613104981;
int[] shifts1 = new int[5] { 15, 5, 3, 2, 0 };
uint[] rez = LFSR(reg1, shifts1);
for (int i = 0; i < 2; i++)
{
Console.WriteLine(rez[i]);
}
Console.ReadKey();
}
}
}