I'm trying to generate random datetime with a code I found on the net. This code made use of $RANDOM. The strange thing is, I could keep executing the script but the datetime result would never change. But when I add "echo $Random", the datetime result changes. Is it something to do with seeding of random variable and executing "echo" somehow reset it?
#echo $RANDOM // This causes desire output
x=$(date -d "$((RANDOM%1+2010))-$((RANDOM%12+1))-$((RANDOM%28+1)) $((RANDOM%23+1)):$((RANDOM%59+1)):$((RANDOM%59+1))" '+%d-%m-%Y %H:%M:%S')
echo $x
OUTPUT
INT,1,100128,2018/05/24 08:00:00,1,0,Test
INT,1,100128,2018/05/24 08:00:00,1,0,Test
INT,1,100128,2018/05/24 08:00:00,1,0,Test
INT,1,100128,2018/05/24 08:00:00,1,0,Test