MCPcopy Create free account
hub / github.com/RGAA-Software/GoDesk / GetVerificationCodeByRand

Method GetVerificationCodeByRand

src/ui/gd_gui/src/gd_verification.cpp:36–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36QString 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
54void GDVerificationCode::UpdateColors()
55{

Callers

nothing calls this directly

Calls 2

initializeRandomSeedFunction · 0.85

Tested by

no test coverage detected