summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qrandom.h
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-11-05 17:58:48 +0100
committerLiang Qi <liang.qi@qt.io>2017-11-05 18:02:18 +0100
commita7e4b645dc5b164eb31c22b558ae7a2f5b674afb (patch)
treec58ac922346363c265ad6873cefe9ed205d84a1d /src/corelib/global/qrandom.h
parentcd542a82b0c2d5c9a4ea167a84e5ea8a25c5d969 (diff)
parentea0e868c4881944207e9b3a77011e05a505ff3b7 (diff)
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts: src/corelib/global/minimum-linux.S src/network/access/qhttpthreaddelegate.cpp src/widgets/kernel/qwidgetwindow.cpp Change-Id: Id2e817e85f85c68f5482c9a12912d35590f9d5f8
Diffstat (limited to 'src/corelib/global/qrandom.h')
-rw-r--r--src/corelib/global/qrandom.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/corelib/global/qrandom.h b/src/corelib/global/qrandom.h
index 2259f2657a..049495d4e8 100644
--- a/src/corelib/global/qrandom.h
+++ b/src/corelib/global/qrandom.h
@@ -51,9 +51,12 @@ class QRandomGenerator
template <typename UInt> using IfValidUInt =
typename std::enable_if<std::is_unsigned<UInt>::value && sizeof(UInt) >= sizeof(uint), bool>::type;
public:
+ static QRandomGenerator system() { return {}; }
+ static QRandomGenerator global() { return {}; }
QRandomGenerator() = default;
// ### REMOVE BEFORE 5.10
+ QRandomGenerator *operator->() { return this; }
static quint32 get32() { return generate(); }
static quint64 get64() { return generate64(); }
static qreal getReal() { return generateDouble(); }
@@ -135,13 +138,14 @@ public:
static Q_DECL_CONSTEXPR result_type max() { return (std::numeric_limits<result_type>::max)(); }
private:
- Q_DISABLE_COPY(QRandomGenerator)
static Q_CORE_EXPORT void fillRange_helper(void *buffer, void *bufferEnd);
};
class QRandomGenerator64
{
public:
+ static QRandomGenerator64 system() { return {}; }
+ static QRandomGenerator64 global() { return {}; }
QRandomGenerator64() = default;
static quint64 generate() { return QRandomGenerator::generate64(); }
@@ -152,9 +156,6 @@ public:
double entropy() const Q_DECL_NOTHROW { return 0.0; }
static Q_DECL_CONSTEXPR result_type min() { return (std::numeric_limits<result_type>::min)(); }
static Q_DECL_CONSTEXPR result_type max() { return (std::numeric_limits<result_type>::max)(); }
-
-private:
- Q_DISABLE_COPY(QRandomGenerator64)
};