How may I get a random character from A to F? I've tried static_cast<char>(65 + rand() % 70) and it doesn't works.