summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/network/access/qnetworkreply
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2017-04-13 21:13:52 -0700
committerLars Knoll <lars.knoll@qt.io>2017-11-08 09:14:03 +0000
commit19b0ce5daa31e2ffebfcf2701143742302f1deb4 (patch)
tree730cccd80947c60ee4872e16f71d4d48d906c354 /tests/benchmarks/network/access/qnetworkreply
parent59c5f7bd9da63621887260fc45e6669282d71ecd (diff)
Change almost all other uses of qrand() to QRandomGenerator
The vast majority is actually switched to QRandomGenerator::bounded(), which gives a mostly uniform distribution over the [0, bound) range. There are very few floating point cases left, as many of those that did use floating point did not need to, after all. (I did leave some that were too ugly for me to understand) This commit also found a couple of calls to rand() instead of qrand(). This commit does not include changes to SSL code that continues to use qrand() (job for someone else): src/network/ssl/qsslkey_qt.cpp src/network/ssl/qsslsocket_mac.cpp tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/benchmarks/network/access/qnetworkreply')
-rw-r--r--tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
index dfa658df11..b2f4cbd7ba 100644
--- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -30,6 +30,7 @@
#include <QDebug>
#include <qtest.h>
#include <QtTest/QtTest>
+#include <QtCore/qrandom.h>
#include <QtNetwork/qnetworkreply.h>
#include <QtNetwork/qnetworkrequest.h>
#include <QtNetwork/qnetworkaccessmanager.h>
@@ -525,7 +526,7 @@ void tst_qnetworkreply::echoPerformance()
data.resize(1024*1024*10); // 10 MB
// init with garbage. needed so ssl cannot compress it in an efficient way.
for (size_t i = 0; i < data.size() / sizeof(int); i++) {
- int r = qrand();
+ char r = char(QRandomGenerator::global()->generate());
data.data()[i*sizeof(int)] = r;
}