summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qrandom.h
diff options
context:
space:
mode:
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 2f72528266..445b520c76 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)