#include <QTime> #include <QDebug> // 根据时间产生随机数 QTime time; time = QTime::currentTime(); qsrand(time.msec() + time.second() * 1000); // 随机数范围 1000 qDebug() << qrand()%1000;
Qt生成随机数
原文:https://www.cnblogs.com/shiyixirui/p/15170606.html