'Code is generating the same random number [duplicate]
Hi I am a new assembly coder and I ran into a problem in my project that I'm fairly certain I know the answer to but I don't know a fix (I've already run the random separately and it works when generating a number one at a time). Problem: When I run the code it fills all the 99 slots with the random num that it chooses one the first random Answer(I think): The random works on the clock so I think the problem is the program is running too fast and already fills the whole timer before the clock changes to the next number Fix: Idk (help me please) Code:
proc ArrayFiller
push ax
push bx
push cx
push dx
push si
xor ax, ax
xor si, si
xor cx, cx
ArrayLoop:
call random
mov al,[RandomNum]
mov [CorrectArray+si], al
;call DelayProc
inc si
inc cx
cmp cx, 99
jbe ArrayLoop
pop si
pop dx
pop cx
pop bx
pop ax
ret
endp ArrayFiller
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|