如何用汇编语言生成随机长度在1-100之间的随机20个字符串?

问题描述 投票:0回答:0

我的代码只生成 10 个长度,但我需要从 1-100。请帮助

INCLUDE Irvine32.inc
strLen=10

.data
arr BYTE strLen DUP(?)

.code
   main PROC
   call Clrscr
   mov esi, offset arr
   mov ecx, 20
 L1:
   call GenerateRandomString
   Loop L1
   call WaitMsg
   exit
 main ENDP

; string_length = 8
; rand(36**string_length).to_s(36)

 GenerateRandomString PROC USES ecx 
   mov ecx, lengthOf arr
 L2:
   mov eax, 26
   call RandomRange
   add eax, 65
   mov [esi], eax
   call WriteChar ; write character
   loop L2 
   call Crlf
   ret
 GenerateRandomString ENDP

END main
assembly random masm irvine32
© www.soinside.com 2019 - 2024. All rights reserved.