|
-
Jan 30th, 2001, 02:03 AM
#1
How do i get a random number?
-
Mar 19th, 2001, 01:25 PM
#2
New Member
Heres a routine
heres a routine
.data
RndInit dd 1110111011100111101110011001b
.code
Random proc
; Entry: al = size of random number
; Return: eax = random number, cl bits in size
mov cl,al
xor eax,eax
mov bl,byte ptr RndInit
and bl,1
EVEN
Gen_bit: ; make n bit numbers
shl eax,1
mov edx,RndInit ; Copy seed
shr edx,9
xor bl,dl
shr edx,5
xor bl,dl
bt ebx,1 ; Copy bit 1 to carry flag
rcr RndInit,1 ; Rotate seed right 1 bit
setc bl ; Set bl TRUE if carry is set
or al,bl
dec cl
jnz Gen_bit
ret
Random endp
-
Jul 18th, 2003, 06:56 PM
#3
Fanatic Member
http://www.agner.org/random/
Has an assembler random number generator.
"Can't" and "shouldn't" are two totally separate things.
All questions should be answered. All answers should be true. That is why I post.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|