| 34 | } |
| 35 | |
| 36 | QString GDVerificationCode::GetVerificationCodeByRand() |
| 37 | { |
| 38 | initializeRandomSeed(QTime::currentTime().second() * 1000 + QTime::currentTime().msec()); |
| 39 | QString destCode; |
| 40 | for (int i = 0; i < code_num_; i++) { |
| 41 | int flag = generateRandomNumberInRange(2); |
| 42 | if (flag == 0) { |
| 43 | int c = '0' + generateRandomNumberInRange(10); |
| 44 | destCode += static_cast<QChar>(c); |
| 45 | } |
| 46 | else { |
| 47 | int c = (generateRandomNumberInRange(2)) ? 'a' : 'A'; |
| 48 | destCode += static_cast<QChar>(c + generateRandomNumberInRange(26)); |
| 49 | } |
| 50 | } |
| 51 | return destCode; |
| 52 | } |
| 53 | |
| 54 | void GDVerificationCode::UpdateColors() |
| 55 | { |
nothing calls this directly
no test coverage detected