diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-07-03 15:19:26 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-07-03 15:19:26 +0200 |
commit | a2b221e595de812f28b4e25ce8014df62407f899 (patch) | |
tree | 2a19edd6ee9bcd92c2db0bce2925beb5fca9c632 /src/corelib/global/qrandom.cpp | |
parent | 2021b36ebdbdd1da1595f281a694b54beb1b23a3 (diff) | |
parent | 8d414e67941fdc45ab682b763a119ecc71291483 (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
.qmake.conf
Change-Id: I936be3c0df2b9845ff6a85eb3d4442cdabe63d37
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 90df8653a7..bf01b7ae2a 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. |