Below is the code i thought would create a random number between 0 to 50(Both included)
#!/bin/bash
var1=51
var=$RANDOM
echo $var
function rand(){
local var1=$1
local var2=$2
local result=$(( var1 % var2 ))
echo $result
}
rand "var" "var1"
The first echo function is working fine its is showing a random number every time but the other echo function is always giving an output of zero