#!/bin/sh -
+random_uniform() {
+ local _upper_bound
+
+ if [[ $1 -gt 0 ]]; then
+ _upper_bound=$(($1 - 1))
+ else
+ _upper_bound=0
+ fi
+
+ echo `jot -r 1 0 $_upper_bound 2>/dev/null`
+}
+
umask 007
PAGE_SIZE=`sysctl -n hw.pagesize`
PAD=$1
GAPDUMMY=$2
-RANDOM1=$((RANDOM % (3 * PAGE_SIZE)))
-RANDOM2=$((RANDOM % PAGE_SIZE))
-RANDOM3=$((RANDOM % PAGE_SIZE))
-RANDOM4=$((RANDOM % PAGE_SIZE))
-RANDOM5=$((RANDOM % PAGE_SIZE))
+RANDOM1=`random_uniform $((3 * PAGE_SIZE))`
+RANDOM2=`random_uniform $PAGE_SIZE`
+RANDOM3=`random_uniform $PAGE_SIZE`
+RANDOM4=`random_uniform $PAGE_SIZE`
+RANDOM5=`random_uniform $PAGE_SIZE`
cat > gap.link << __EOF__