lundi 3 avril 2023

How to generate random 20 string with random length between 1-100 in assembly language?

My code only generate 10 length but I need to be from 1-100. Pls help

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



Aucun commentaire:

Enregistrer un commentaire