summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2017-06-12 15:33:12 -0700
committerThiago Macieira <thiago.macieira@intel.com>2017-06-30 14:53:58 +0000
commit420139a36dace3bb8f78f2d65b30f7657668d888 (patch)
treee40f613627f73ee8aa8d61f062c0741f86897b55 /src
parent7bd7815f613c6f1ae0215d0b6a0ab5b7a6e72a59 (diff)
downloadqtlocation-420139a36dace3bb8f78f2d65b30f7657668d888.tar.gz
Use QRandomGenerator instead of q?rand
Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/geoservices/nokia/qgeouriprovider.cpp3
-rw-r--r--src/plugins/position/android/src/jnipositioning.cpp6
2 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/geoservices/nokia/qgeouriprovider.cpp b/src/plugins/geoservices/nokia/qgeouriprovider.cpp
index 80b47f31..f36a6694 100644
--- a/src/plugins/geoservices/nokia/qgeouriprovider.cpp
+++ b/src/plugins/geoservices/nokia/qgeouriprovider.cpp
@@ -37,6 +37,7 @@
#include <QMap>
#include <QVariant>
+#include <QRandomGenerator>
#include <QSet>
#include <QString>
@@ -60,7 +61,7 @@ QGeoUriProvider::QGeoUriProvider(
QString QGeoUriProvider::getCurrentHost() const
{
if (m_maxSubdomains) {
- QString result(m_firstSubdomain.toLatin1() + qrand() % m_maxSubdomains);
+ QString result(m_firstSubdomain.toLatin1() + QRandomGenerator::bounded(m_maxSubdomains));
result += '.' + m_currentHost;
return result;
}
diff --git a/src/plugins/position/android/src/jnipositioning.cpp b/src/plugins/position/android/src/jnipositioning.cpp
index 9bd49e90..e79e64d5 100644
--- a/src/plugins/position/android/src/jnipositioning.cpp
+++ b/src/plugins/position/android/src/jnipositioning.cpp
@@ -40,6 +40,7 @@
#include <QDateTime>
#include <QDebug>
#include <QMap>
+#include <QRandomGenerator>
#include <QtGlobal>
#include <QtCore/private/qjnihelpers_p.h>
#include <android/log.h>
@@ -100,7 +101,6 @@ namespace AndroidPositioning {
{
static bool firstInit = true;
if (firstInit) {
- qsrand( QDateTime::currentMSecsSinceEpoch() / 1000 );
firstInit = false;
}
@@ -109,7 +109,7 @@ namespace AndroidPositioning {
QGeoPositionInfoSourceAndroid *src = qobject_cast<QGeoPositionInfoSourceAndroid *>(obj);
Q_ASSERT(src);
do {
- key = qrand();
+ key = QRandomGenerator::get32();
} while (idToPosSource()->contains(key));
idToPosSource()->insert(key, src);
@@ -117,7 +117,7 @@ namespace AndroidPositioning {
QGeoSatelliteInfoSourceAndroid *src = qobject_cast<QGeoSatelliteInfoSourceAndroid *>(obj);
Q_ASSERT(src);
do {
- key = qrand();
+ key = QRandomGenerator::get32();
} while (idToSatSource()->contains(key));
idToSatSource()->insert(key, src);