At the beginning of the command, generate a random number between 1 and 1000. Then use that number as the timeout value for an SSH connection to localhost.
awk 'BEGIN { for(i=0;i<1;i++) { print int(1+rand() * 1000) } }' | xargs -I {} ssh -o ConnectTimeout={} localhost