aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests/include/libtest.shlib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/zfs-tests/include/libtest.shlib')
-rw-r--r--tests/zfs-tests/include/libtest.shlib15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib
index e2274d1b1..b3bd3dfdf 100644
--- a/tests/zfs-tests/include/libtest.shlib
+++ b/tests/zfs-tests/include/libtest.shlib
@@ -3934,3 +3934,18 @@ function faketty
script --return --quiet -c "$*" /dev/null
fi
}
+
+#
+# Produce a random permutation of the integers in a given range (inclusive).
+#
+function range_shuffle # begin end
+{
+ typeset -i begin=$1
+ typeset -i end=$2
+
+ if is_freebsd; then
+ seq ${begin} ${end} | random -f -
+ else
+ shuf -i ${begin}-${end}
+ fi
+}