Random codes in C++