C++ (Qt)QString Widget::passwordRand(qint64 min, qint64 max){ QString chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); QString password; qint64 amount = mt_rand(min, max); for (int i = 0; i < amount; i++) { int num = qrand() % chars.size(); password += chars.at(num); } return password;} qint64 Widget::mt_rand(qint64 a, qint64 b){ qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); return qrand()%(b-a+1)+a;}
C++ (Qt)[b]qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));[/b]
C++ (Qt)qsrand(QDateTime::currentMSecsSinceEpoch());
C++ (Qt)QByteArray md5Hash = QCryptographicHash::hash("some_login", QCryptographicHash::Md5);