Copy Code code as follows:
@echo off
:: To find 1-100 of the range of random 5 different values
:: Generating a random sequence between 0-99 R1
::
::
::
@echo off
Setlocal enabledelayedexpansion
:: Initialization sequence sequence
FOR/L%%i in (0,1,99) do (
Set rnum%%i=%%i
)
:: Random exchange of sequence
FOR/L%%i in (0,1,99) do (
set/a rnd=!random! %% 100
Call Set tmp=%%rnum!rnd!%%
Set rnum!rnd!=!rnum%%i!
Set rnum%%i=!tmp!
)
Set Rnum
Pause
Goto:eof
@echo off
:: Code by JM 2006-1-5 CMD@XP
: Begin
Cls
Set Times=0
Set count=0
: Loop
set/a num=%random%%%99+1
If not defined num%num% (
Set num%num%=%num%
set/a count+=1
Call Echo%%num%%
)
set/a times+=1
If%times% equ 20 (
FOR/L%%i in (1,1,99) do set num%%i=
Set Times=0
)
If%count% LSS 5 goto Loop
Pause>nul
Goto BEGIN
@echo off
:: Code by JM 2007-1-6 CMD@XP
:: Because of the use of the echo|find structure, the speed is relatively slow
::
: Begin
Cls
Set count=0
: Loop
set/a num=%random%%%100+1
echo%str%|find "%num%" >nul&&goto loop
Call Set str=%%str%%%num%
set/a count+=1
If%count% LSS 5 goto Loop
Echo%str%
Set str=
Pause
Goto BEGIN
@echo off&setlocal enabledelayedexpansion
::
::
FOR/L%%a in (1;1;5) do (
set/a b=!random!%%99+1
Call:p P!b!
)
Goto:eof
:p P
If not defined%1 (set%1=a) Else Goto loop
Echo%1
Goto:eof
: Loop
set/a b=!random!%%99+1
Call:p P!b!
@echo off
::
::
Set max=100
Set n=5
: Start
Cls
Echo%time%
Set num=
Set tmp$=
: Loop
set/a randomloop= (%random%+%random%+%random%)/3%%%max%+1
For%%n in (%tmp$%) do if "%randomloop%" = "%%n" goto loop
Call Set tmp$=%%tmp$%%%randomloop%
set/a num+=1
Set random_%num%=%randomloop%
If%num% LSS%n% Goto Loop
Echo%tmp$%
Echo%time%
Pause
Goto Start
Exit
@echo off
::
::
: Start
Cls
Set num=
Set tmp$=
: Loop
set/a randomloop=%random%%%99+1
For%%n in (%tmp$%) do if "%randomloop%" = "%%n" goto loop
Call Set tmp$=%%tmp$%%%randomloop%
set/a num+=1
Set random_%num%=%randomloop%
If%num% LSS 5 goto Loop
FOR/L%%n in (1,1,%num%) does call set/p=%%random_%%n%%<nul
Echo.
Pause
Goto Start
Exit