Fix Wrong MAC address by "Change MAC address"

Part 1 of 7088
This commit is contained in:
sum2012 2014-11-13 22:13:57 +08:00
parent cbef4fae26
commit 122c3b866e

View File

@ -239,9 +239,15 @@ const char *DefaultLangRegion() {
const char *CreateRandMAC() {
std::stringstream randStream;
u32 value;
srand(time(0));
for(int i = 0; i < 6; i++) {
randStream << std::hex << (rand() % 256); //generates each octet for the mac in hex format
value = rand() % 256;
if (value >= 0 && value <= 9) {
randStream << '0' << value;
}
else
randStream << std::hex << value;
if (i<5) {
randStream << ':'; //we need a : between every octet
}