Re: A86: Random


[Prev][Next][Index][Thread]

Re: A86: Random




In a message dated 10/13/99 17:33:56 Eastern Daylight Time, 
ironman_294@hotmail.com writes:

> Ok im looking for a random function.  Now I think that register r is a 
>  random number or no?  Also I was looking at something that used the call 
>  _setxxop2 I included every file that i have and i still could not get it 
to 
>  work does anyone know whats going on here?

Here's a good random routine by Matthew Shepcar (Scabby).  It's from 
Bomberbloke.

Random:
        ld hl,0
        ld de,12345
Seed =$-2
        ld a,7921 & 255
        ld bc,1000h+(7921/256)
domult16:
    add hl,hl
    rla
    rl c
    jr nc,noadd16
    add hl,de
noadd16:
    djnz domult16
    inc hl
    ld (Seed),hl ;seed=(seed*7921+1) MOD 65536
    ld a,h
    ret


----
Jonah Cohen
<ComAsYuAre@aol.com>
http://linux.hypnotic.org/~jonah/