Is it possible to implement random number generation in assembler language?
If yes, how do i do that?
hi
here is a algo from firewoks project
random PROC base:DWORD ; Park Miller random number algorithm
mov eax, seed ; from M32lib/nrand.asm
xor edx, edx
mov ecx, 127773
div ecx
mov ecx, eax
mov eax, 16807
mul edx
mov edx, ecx
mov ecx, eax
mov eax, 2836
mul edx
sub ecx, eax
xor edx, edx
mov eax, ecx
mov seed, ecx
div base
mov eax, edx
ret
random ENDP
greets
masmlib already contains a random number generator (nrandom)
and in case of generating 0.F --> 0123456789ABCDEF ::)
i wrote an asm version of the well512 random number generator(just google it).
http://www.masm32.com/board/index.php?topic=11679.msg122005#msg122005
http://www.masm32.com/board/index.php?topic=11679.msg121891#msg121891
theres a seperate asm file (well512.asm) that you can assemble and add to your own library if you want and a small example of its usage
last week - everyone was writing one :P
look in the laboratory and workshop
Quote from: dedndave on November 20, 2010, 08:45:10 PM
last week - everyone was writing one :P
look in the laboratory and workshop
No, Dave is not kidding. Go here (http://www.masm32.com/board/index.php?topic=11679.msg123994#msg123994).