diff --git a/common/base.sh b/common/base.sh index c8e4be9..0be2614 100644 --- a/common/base.sh +++ b/common/base.sh @@ -318,18 +318,27 @@ setup_md5() exists $MD5 || MD5=md5 } +setup_random() +{ + [ -n "$RCUT" ] && return + RCUT="cut -c 1-17" + # some shells can operate with 32 bit signed int + [ $((0x100000000)) = 0 ] && RCUT="cut -c 1-9" +} + random() { # $1 - min, $2 - max local r rs setup_md5 + setup_random if [ -c /dev/urandom ]; then read rs