A83: Re: Re: Random numbers


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

A83: Re: Re: Random numbers




That won't work because you are masking certain bits... it will only work
with numbers between 0 and {1,3,7,15....}.
The way I would get my random numbers is with ZLib routine 2.
Just:
ld b,9
call vector0  ; or whatever you assigned lib2 to
inc a ; a now holds a number between 1 and 9

If you hate SOS, you could steal the routine from ZLib...
or you could do something like:
ld a,r
rra
ld h,0
ld l,a
ld d,h
ld e,a
ld b,9
loop:
add hl,de
djnz loop
inc h ; h holds 1-9 random number

-----Original Message-----
From: Trey Jazz <joemama@minot.com>
To: assembly-83@lists.ticalc.org <assembly-83@lists.ticalc.org>
Date: Thursday, June 18, 1998 3:38 PM
Subject: A83: Re: Random numbers


>
>its _SUPPOSED_ to work if you:
>
> ld a,r
> and 8
> inc a
>
>but ive tried before and havnt had success :/
>
>
>>I'm making a Whack a mole game and I need to know how to get a random
>>number between 1 and 9.
>>
>>--------------------------------------------------------------------------
-
>--------------------------------------------
>>Mastermind--benjamin99@juno.com, www.bigfoot.com/~mastermind5
>>IRC: Master_M
>>ICQ: 11341114
>>-Its all about the Benjamins
>>
>>_____________________________________________________________________
>>You don't need to buy Internet access to use free Internet e-mail.
>>Get completely free e-mail from Juno at http://www.juno.com
>>Or call Juno at (800) 654-JUNO [654-5866]
>>
>