I discussed random numbers in
tip 3239 » %RANDOM% generates a random integer in the range of 0 - 32767,
and
tip 7375 » Random freeware sets %ERRORLEVEL% to a random number between the lowerbound and upperbound parameters.
I have scripted RNmbr.bat to generate a random number that is seeded with the current time.
The syntax for using RNmbr.bat is:
RNmbr VAR
Where VAR is a call directed numeric environment variable that will contain the random number.
RNmbr.bat contains:
@echo off if \{%1\}==\{\} @echo Syntax RNmbr VAR&goto :EOF call set %1=%time::=% call set %1=%%%1: 0=%%% call set %1=%%%1:.=-%%% call set %1=%%%1:-0=-%%% call set /a %1=%RANDOM% * %%%1%%%
0 comments
Hide comments