Код:

@Echo Off
cls
set /A min=1, max=20
For /L %%i In (1,1,10) Do (
call :gen
call echo Attempt %%i n=%%r10%%
Call ping -n %%r10%% 127.0.0.1 >nul
)
pause
Exit /B
:gen
set /a r10=min+(max-min+1)*%random%/32768
exit /b
Код:

@Echo Off
cls
set /A min=1, max=20
For /L %%i In (1,1,10) Do call :gen %%i
pause
Exit /B
:gen
set /a r10=min+(max-min+1)*%random%/32768
echo Attempt %1 n=%r10%
ping -n %r10% 127.0.0.1 >nul
exit /b