A85: Random
[Prev][Next][Index][Thread]
A85: Random
I used this random routine in a Usgard game I am making:
Random:
ld a,r
srl a
and 3 ;I want -1, 0, or 1
jr z,Random
dec a
dec a
--------------
The problem is that 1 comes up nearly all the time.
Is there a way to make it more random, and give all the same probablity?
Also, it seems that if I push the right arrow key, it never returns -1.
I added "sub a" before the random, in case storing the key in the A register
was affecting the outcome, but that still didn't do anything.