In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how to display five random numbers in batch processing. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
The code is as follows:
@ echo off
: find 5 different random values in the range of 1-100
:: generate a random sequence R1 between 0 and 99
::
::
::
@ echo off
Setlocal EnableDelayedExpansion
:: initialize sequence sequence
For / l% I in (0mem1mem99) do (
Set rnum%%i=%%i
)
:: random exchange of sequence
For / l% I in (0mem1mem99) do (
Set / a rndflowers random! 100
Call set tmpins%% rnumquota rndbits%%
Set rnum%% I!
Set rnum%% iConstructmp!
)
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 (1mem1mem99) 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 the structure of echo | find is used, the speed is relatively slow
::
: begin
Cls
Set count=0
: loop
Set / a num=%random%%0+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% an in (1 * 5) do (
Set/a breadwinner% 99% 1
Call: pp! b!
)
Goto: eof
: pp
If not defined 1 (set 1yoga) else goto loop
Echo 1
Goto: eof
: loop
Set/a breadwinner% 99% 1
Call: pp! b!
@ echo off
::
::
Set Max=100
Set Nickel 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 (1JI% Num%) do call set / p =% random_%%n%%
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.