程序随机化数字 1-53 而不重复。
无法使Check
循环工作,但我知道这是问题所在,因为没有它它可以工作,但我需要它所以我不会重复,还有你如何按顺序对数字进行排序?
Include Irvine32.inc
.data
a dword 1
b dword 53
delta dword ?
blank byte " ",0
array dword 52 dup(0)
lenarray = LengthOF array
.code
main PROC
call randomize
mov eax,b
sub eax,a
inc eax
mov delta,eax
mov esi,offset array
mov edx,offset blank
mov ecx, lenarray
xxx:
push ecx
push esi
bk: mov eax,delta
call randomrange
add eax,a
mov esi,0
mov ecx,lenarray
Check:
cmp eax,[esi]
je bk ;if duplicate
add esi,4
loop Check
pop esi
pop ecx
call writedec
call writestring
mov [esi],eax
add esi,4
loop xxx