In POSIX sh, RANDOM is undefined: use always the other method

This commit is contained in:
Badlop 2021-12-23 11:33:17 +01:00
parent f4e2d278ba
commit 84d23e60d1
1 changed files with 6 additions and 13 deletions

View File

@ -15,19 +15,12 @@
INPUT=$1
if test -n ${BASH_VERSION:-''} ; then
get_random ()
{
R=$RANDOM
}
else
for n in $(od -A n -t u2 -N 48 /dev/urandom); do RL="$RL$n "; done
get_random ()
{
R=${RL%% *}
RL=${RL#* }
}
fi
for n in $(od -A n -t u2 -N 48 /dev/urandom); do RL="$RL$n "; done
get_random ()
{
R=${RL%% *}
RL=${RL#* }
}
get_random
WAVE1_AMPLITUDE=$((2 + R % 5))