History

Replace deprecated qrand

Dale Glass committed 4 years ago

Commit 61cce581 parent a7f6fed1 file · +2 −3Browse files

Showing the changes to interface/src/scripting/GooglePolyScriptingInterface.cpp (1 of 1 file). Show all

Unified · Split

interface/src/scripting/GooglePolyScriptingInterface.cpp+2−3
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #include <QString>
2323 #include <QTime>
2424 #include <QUrl>
25+#include <QRandomGenerator>
2526
2627 #include "ScriptEngineLogging.h"
2728
@@ -102,9 +103,7 @@ QString GooglePolyScriptingInterface::getModelInfo(const QString& input) { · 74 unmodified lines
102103 }
103104
104105 int GooglePolyScriptingInterface::getRandIntInRange(int length) {
105− QTime time = QTime::currentTime();
106− qsrand((uint)time.msec());
107− return qrand() % length;
106+ return QRandomGenerator::global()->bounded(length);
108107 }
109108
110109 QUrl GooglePolyScriptingInterface::formatURLQuery(const QString& keyword, const QString& category, const QString& format) {