summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/src/examples/bearercloud.qdoc6
-rw-r--r--examples/svg/network/bearercloud/bearercloud.cpp5
2 files changed, 5 insertions, 6 deletions
diff --git a/doc/src/examples/bearercloud.qdoc b/doc/src/examples/bearercloud.qdoc
index eeead0d..a8465e0 100644
--- a/doc/src/examples/bearercloud.qdoc
+++ b/doc/src/examples/bearercloud.qdoc
@@ -68,9 +68,9 @@
\section1 Setting the Scene
- When constructing the scene we first calculate some random offsets using the global qsand()
- and qrand() functions. We will use these offsets to scatter the initial position of new Cloud
- objects.
+ When constructing the scene we first calculate some random offsets using \l
+ QRandomGenerator. We will use these offsets to scatter the initial position
+ of new Cloud objects.
Next we place a text item in the center of the scene to represent the local device and
surround it with four concentric circles to help visualize the orbits.
diff --git a/examples/svg/network/bearercloud/bearercloud.cpp b/examples/svg/network/bearercloud/bearercloud.cpp
index bf2a444..d3f02f2 100644
--- a/examples/svg/network/bearercloud/bearercloud.cpp
+++ b/examples/svg/network/bearercloud/bearercloud.cpp
@@ -43,8 +43,8 @@
#include <QGraphicsTextItem>
#include <QTimer>
-#include <QDateTime>
#include <QHostInfo>
+#include <QRandomGenerator>
#include <QDebug>
@@ -60,9 +60,8 @@ BearerCloud::BearerCloud(QObject *parent)
{
setSceneRect(-300, -300, 600, 600);
- qsrand(QDateTime::currentDateTime().toTime_t());
- offset[QNetworkConfiguration::Active] = 2 * M_PI * qrand() / RAND_MAX;
+ offset[QNetworkConfiguration::Active] = QRandomGenerator::bounded(2 * M_PI);
offset[QNetworkConfiguration::Discovered] = offset[QNetworkConfiguration::Active] + M_PI / 6;
offset[QNetworkConfiguration::Defined] = offset[QNetworkConfiguration::Discovered] - M_PI / 6;
offset[QNetworkConfiguration::Undefined] = offset[QNetworkConfiguration::Undefined] + M_PI / 6;