summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qrandom.h
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-07-03 15:19:26 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-07-03 15:19:26 +0200
commita2b221e595de812f28b4e25ce8014df62407f899 (patch)
tree2a19edd6ee9bcd92c2db0bce2925beb5fca9c632 /src/corelib/global/qrandom.h
parent2021b36ebdbdd1da1595f281a694b54beb1b23a3 (diff)
parent8d414e67941fdc45ab682b763a119ecc71291483 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts: .qmake.conf Change-Id: I936be3c0df2b9845ff6a85eb3d4442cdabe63d37
Diffstat (limited to 'src/corelib/global/qrandom.h')
-rw-r--r--src/corelib/global/qrandom.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/corelib/global/qrandom.h b/src/corelib/global/qrandom.h
index 46d3e0e152..260fc1501a 100644
--- a/src/corelib/global/qrandom.h
+++ b/src/corelib/global/qrandom.h
@@ -122,14 +122,16 @@ public:
return quint32(value);
}
- int bounded(int highest)
+ quint32 bounded(quint32 lowest, quint32 highest)
{
- return int(bounded(quint32(highest)));
+ Q_ASSERT(highest > lowest);
+ return bounded(highest - lowest) + lowest;
}
- quint32 bounded(quint32 lowest, quint32 highest)
+ int bounded(int highest)
{
- return bounded(highest - lowest) + lowest;
+ Q_ASSERT(highest > 0);
+ return int(bounded(0U, quint32(highest)));
}
int bounded(int lowest, int highest)