C++ based constraint random generator