Generating random number using srand() and rand() Qt

You can use random function from stdlib and fix time to maximize pseudo random operation in a short period of short time.

const int MainWindow::getNumber() const
qsrand( (unsigned)time(NULL) ^random());
return qrand() % max;

Using qsrand(QTime::currentTime().msec()) it can also be done, but in a short period of time the function will return the same value.