Re: A86: random values
[Prev][Next][Index][Thread]
Re: A86: random values
In a message dated 11/5/98 6:31:14 PM Eastern Standard Time, KidFedX@aol.com
writes:
> it's probably really simple -- but how do you get random numbers to
generate?
> Particularly integers, like 1-10. Okay thanks.
> --Kid
>
well, it isn't TOO easy. there are a couple built in routines, but if all you
need is small integers, then jimmy mardell's routine is really good:
;Randomization routine by Jimmy Mardell
PRandom: ; Creates a pseudorandom number 0 <= x < A
ld b,a
ld a,r
add a,a
ld hl,0
ld d,0
ld e,a
RMul:
add hl,de
djnz RMul
ld a,h
ret