Re: A92: random number
[Prev][Next][Index][Thread]
Re: A92: random number
On Mon, 7 Sep 1998 19:05:02 +0200 "Philippe HUCK"
<philhuck@club-internet.fr> writes:
>Does anybody know how to generate random numbers ? And in assembly,
>what would it be ?
>
>Merci. Thanx.
>
>MP
Flib::Random does it easily. Here's what flib.h says:
;---------------------------------------------
; random(void)
;
; Function: Return a pseudorandom number
;
; input: D0.W = upper limit
; output: D0.W = random number in [0..limit-1]
;---------------------------------------------
flib::random equ flib@000C
So you just put the upper limit in d0, and call the function.
It returns a number between (And including) zero and the
upper limit minus one. So d0 is 6 when you call it it will
return 0,1,2,3,4, or 5
Hope this helps...
Daniel Plaisted
dsplaisted@bigfoot.com
ICQ#-10360037
_____________________________________________________________________
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]
References: