int main(int argc, char* argv[]) {
	std::string s_bit;
	LFSR *lfsr = new LFSR("01101000010", 8);
	for (int i = 0; i < 10; i++) {
		int bit = lfsr->generate(5);
		s_bit = std::to_string(bit);
		std:: cout << *lfsr << " " <<  s_bit << std::endl;
	}
	return 0;
}
Ejemplo n.º 2
0
sf::Image transform(sf::Image image, LFSR lfsr)
{
	 sf::Vector2u size = image.getSize();
	 int x,y;
	 sf::Color p;

	 for(int x=0; x<size.x; x++)
	 {
		  for(int y=0; y<size.y; y++)
		  {
				p = image.getPixel(x,y);
				p.r = p.r^lfsr.generate(8);
			   p.g = p.g^lfsr.generate(16);
				p.b = p.b^lfsr.generate(20);
				image.setPixel(x,y,p);
		  }
	 }

	 return image;

}