bitwise generator written in c++