.model small .386 public seed,rand .data tseed dd 45168297h mval dd 015a4e35h .code ; ; sets seed ; ; grab for eaxmple the dword at 40:6ch (timer ticks) ; for decent starting seeds ; seed PROC mov [tseed],eax ret seed ENDP ; ; random number ; ; entry: ; AX = modulus. modulous of 0 = 65536 ; ; exit: ; AX = value ; rand PROC push edx push bx push ax mov eax,[tseed] mul [mval] inc eax mov [tseed],eax shr eax,16 pop bx or bx,bx jz nodiv sub dx,dx div bx mov ax,dx nodiv: pop bx pop edx ret rand ENDP end