#include <iostream>
#include <cstdlib>
#include <ctime>
std::string generateHex(int length) {
const char hexChars[] = "0123456789ABCDEF";
std::string hexStr;
for (int i = 0; i < length; ++i) {
hexStr += hexChars[rand() % 16];
}
return hexStr;
}
int main() {
srand(static_cast<unsigned int>(time(0))); // Seed the random number generator
int length = 8; // Length of the hex string
std::string hexNumber = generateHex(length);
std::cout << "Random Hexadecimal Number: " << hexNumber << std::endl;
}
/*
run:
Random Hexadecimal Number: 642F0AC0
*/