Re: A85: random numbers
[Prev][Next][Index][Thread]
Re: A85: random numbers
i used Jimmy Mardell's PRandon routine in solytare for random numbers.
it's fairly small and fast. the routine can be found in the ZTetris
source (it's also in the solytare source). you would use it like
this:
;get a random number between 11 and 20
ld a,10 ;number of random values (20-11+1)
call PRandom ;use the correct "call" method for your shell
;a is returned with a value 0-9
add a,11 ;a now has value 11-20
i think that is all correct.
-mike pearce
On Thu, 16 Apr 1998 15:00:05 -0400, you wrote:
>
>how can i generate random numbers between two given values? for example,
>here is the code needed for a ti-86:
>
>Random:
> call _RANDOM
> ld a,(temp)
> call _setxxop2
> call _FPMULT
> call _CONVOP1
> ld a,e
> ret
>
>temp is the upper boundary for the random number. how could i do this on
>the 85?
>
>
>
References: