I’ve write the following code in bash, this code tends to print a matrix of 200×13 random numbers (we have 200 line printed with 13 numbers per line). I want this code to be more flexible such that one can change size of the matrix printed (number of line and number of number per line) without re-write the code
for (( k = 0; k < 200; k++ ))
do
echo $(( $RANDOM - 16384 )) $(( $RANDOM - 16384 )) $(( $RANDOM - 16384 )) $(( $RANDOM - 16384 )) $(( $RANDOM - 16384 )) $(( $RANDOM - 16384 )) $(( $RANDOM - 16384 )) $(( $RANDOM - 16384 )) $(( $RANDOM - 16384 )) $(( $RANDOM - 16384 )) $(( $RANDOM - 16384 )) $(( $RANDOM - 16384 )) $(( $RANDOM - 16384 ))
done
thanks for any help.
First, you want to change the printing of the columns to another for-loop:
Then, you can parametrize your k max and j max: