RandomRange PROC
Generates an unsigned pseudo-random 32-bit
integer in the range of 0 through (n-1).
Call args: EAX = n, the range
Return arg: EAX = random (0 to n-1)
Example: Get a random number from 1 to 100
.data
ranNum DWORD ?
.code
mov eax,100 ;get random 0 to 99
call RandomRange ;
inc eax ;make range 1 to 100
mov ranNum,eax ;save random number
Notes: To re-seed the random number generator, use the
Randomize procedure.| Converted from CHM to HTML with chm2web Pro 2.85 (unicode) |