Qt中随机数生成器 QTime time; time = QTime::currentTime(); qsrand(time.msec() + time.second() * 1000); int n = qrand() % 10000; //产生10000以内的随机数