summaryrefslogtreecommitdiff
path: root/tests/support/util.tcl
diff options
context:
space:
mode:
authorHuang Zhw <huang_zhw@126.com>2021-09-12 16:31:22 +0800
committerGitHub <noreply@github.com>2021-09-12 11:31:22 +0300
commit75dd230994275c4448510d93d6c86541038574d2 (patch)
tree3c57ef0dfc0901cc5165b0f029224cf41b1a366d /tests/support/util.tcl
parent418c2e79313b367e64e47d38edd59f9f22a3b4fa (diff)
downloadredis-75dd230994275c4448510d93d6c86541038574d2.tar.gz
bitpos/bitcount add bit index (#9324)
Make bitpos/bitcount support bit index: ``` BITPOS key bit [start [end [BIT|BYTE]]] BITCOUNT key [start end [BIT|BYTE]] ``` The default behavior is `BYTE`, so these commands are still compatible with old.
Diffstat (limited to 'tests/support/util.tcl')
-rw-r--r--tests/support/util.tcl5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/support/util.tcl b/tests/support/util.tcl
index 1c6914ef7..a834d4abd 100644
--- a/tests/support/util.tcl
+++ b/tests/support/util.tcl
@@ -187,6 +187,11 @@ proc randomInt {max} {
expr {int(rand()*$max)}
}
+# Random integer between min and max (excluded).
+proc randomRange {min max} {
+ expr {int(rand()*[expr $max - $min]) + $min}
+}
+
# Random signed integer between -max and max (both extremes excluded).
proc randomSignedInt {max} {
set i [randomInt $max]