The following short script prints a random ten-digit binary number:
#!/usr/bin/zsh
point=''
for i in `seq 1 10`
do
echo $RANDOM >/dev/null
point=$point`if [ $RANDOM -gt 16383 ]; then echo 0; else echo 1; fi`
done
echo $point
However, if I remove the apparently useless echo $RANDOM >/dev/null
line, the script always prints either 1111111111
or 0000000000
.
Why?
See Question&Answers more detail:os