Re: A86: Re: Assembly-86 Digest V1 #869
[Prev][Next][Index][Thread]
Re: A86: Re: Assembly-86 Digest V1 #869
In a message dated 4/21/99 18:02:19 Eastern Daylight Time,
MalcolmJ1@email.msn.com writes:
> don't you guys know that there is a random register called 'r' that is only
> accessed through the 'a' register:
> ld a,r
> 'r' is random because it is incremented every intsruction the processor
> executes. you can just do that. for example you needed a number 0-3
> randomly:
> ld a,r
> and %0000 0011
> quit wasting your time on a random number routine!
>
that only works for ranges which are powers of two. and it's only
pseudo-random, because consecutive calls will tend to follow patterns based
on the number of instructions between each call. it is not a very random
routine when used more than once.