Below is a method I use, translated from 'c' into assembly, that I've
used for years. I found the original code in an issue of DDJ..

Seed "x1" and "x2" with numbers that are prime.

x1 label word
        dw      ?

x2 label word
        dw      ?

.
.
.

randi   proc    near
; returns in ax a number in 0 ..CX-1
; destroys ax - calls rand0
;
ri:     push    dx
        call    rand0
        mul     cx      ; (dxax) = u*rand0()
        mov     ax,dx   ; ax = u*rnad0()/max0
        pop     dx
        test    ah,80h
        jz      rix
        inc     ax
rix:
        ret             ; ax = u*rand0()/max
;
randi   endp

rand0   proc    near
; return in ax a quasi-random number
; preserves all registers but ax and flags
r:      push    dx
        mov     dx,x2
        mov     ax,x1
        mov     x2,ax
        add     ax,dx
        rol     ax,1
        mov     x1,ax
        pop     dx
rx:     ret
;
rand0   endp

Sincerely,

 MarcW 