Skip to content

Commit

Permalink
Fix division by 0
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
  • Loading branch information
jancborchardt committed Jan 11, 2019
1 parent 0e3c80d commit 58a11d1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions randomblock.sh
Expand Up @@ -35,11 +35,10 @@ $line" || {
arr[$i]="$line"
s=0;
}
done < $RANDOMFILE
done < "$RANDOMFILE"

# Choose index to be a random number from 0 to the length of the array
# Code from https://stackoverflow.com/a/2388555
# TODO: Catch division by 0
selectedblock=${arr[$RANDOM % ${#arr[@]} ]}

echo "$RANDOMFILE"
Expand Down

0 comments on commit 58a11d1

Please sign in to comment.