diff options
author | Liang Qi <liang.qi@qt.io> | 2019-07-05 15:37:50 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-07-05 15:37:50 +0200 |
commit | deee7b7eced5b240e3161d655319dbaaf2f8965c (patch) | |
tree | 4ad6db0e97482c24f02f111cbfeec224535feb73 /src/corelib/global/qrandom.cpp | |
parent | bcd4b14026094d0077ad1069054676cc6da96251 (diff) | |
parent | 6ad08b9cad4efefc72e64deaa0b720a3aab0fa54 (diff) |
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
.qmake.conf
qmake/generators/makefile.cpp
Change-Id: Ifb2633a69d0bf8cdf12d799c6259beefc279c49e
Diffstat (limited to 'src/corelib/global/qrandom.cpp')
-rw-r--r-- | src/corelib/global/qrandom.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index 379e37ac07..711eb8f4d5 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -903,6 +903,10 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel \snippet code/src_corelib_global_qrandom.cpp 12 + If the \a highest parameter is negative, the result will be negative too; + if it is infinite or NaN, the result will be infinite or NaN too (that is, + not random). + \sa generateDouble(), bounded() */ @@ -934,7 +938,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel \overload Generates one random 32-bit quantity in the range between 0 (inclusive) and - \a highest (exclusive). \a highest must not be negative. + \a highest (exclusive). \a highest must be positive. Note that this function cannot be used to obtain values in the full 32-bit range of int. Instead, use generate() and cast to int. @@ -946,8 +950,11 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel \fn quint32 QRandomGenerator::bounded(quint32 lowest, quint32 highest) \overload - Generates one random 32-bit quantity in the range between \a lowest (inclusive) - and \a highest (exclusive). The same result may also be obtained by using + Generates one random 32-bit quantity in the range between \a lowest + (inclusive) and \a highest (exclusive). The \a highest parameter must be + greater than \a lowest. + + The same result may also be obtained by using \l{http://en.cppreference.com/w/cpp/numeric/random/uniform_int_distribution}{\c std::uniform_int_distribution} with parameters \a lowest and \c{\a highest - 1}. That class can also be used to obtain quantities larger than 32 bits. @@ -968,7 +975,8 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel \overload Generates one random 32-bit quantity in the range between \a lowest - (inclusive) and \a highest (exclusive), both of which may be negative. + (inclusive) and \a highest (exclusive), both of which may be negative, but + \a highest must be greater than \a lowest. Note that this function cannot be used to obtain values in the full 32-bit range of int. Instead, use generate() and cast to int. |