本帖最后由 tmplinshi 于 2011-7-27 16:15 编辑
以此类推
前一个为4或5或6,后一个则不能为4、5、6
每两个数字之间都有空格
生成完后将每个数字替换 ...
Zombie 发表于 2011-7-27 14:17
也就是相邻的两个不能重复,是吧?- @echo off
- setlocal enabledelayedexpansion
- set /a count = 0, LastNum = 0, list_num = 0, list_letter = 0
- set letters=#ABCDEFGHIJKLMNOPQR
-
- :loop
- set /a n = %random% %% 18 + 1
- if %n% == %LastNum% goto loop
- set list_num=%list_num% %n%
- set list_letter=%list_letter% !letters:~%n%,1!
- set /a count += 1, LastNum = n
- if %count% neq 25 goto loop
-
- for %%a in (list_num list_letter) do set %%a=!%%a:* =!
-
- set list
- pause
复制代码
|