Re: A89: Random Number generator in C


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

Re: A89: Random Number generator in C




The easiest way is to use userlib... which, if I am not mistaken, means
you will have to write a seperate asm file to be linked with your c
file.

in the asm:
   include "userlib.h"
   xdef rand
   xdef rand_seed

rand equ userlib::random
rand_seed equ userlib::rand_seed

Then in your c file, put something like this:

extern WORD rand(void);
extern WORD rand_seed;

#define random(hi) \
	asm("move.w hi,%d0"); \
	rand();


JHill8075@aol.com wrote:
> 
> Does anyone know where I can find a random number generator in C? I need it
> to generate random numbers from  0 to 144 (inclusive). Thanks.
> 
>         Josh
>         <A HREF="http://pa.ticalc.org">Programmers Anonymous</A> Member

-- 
Scott "_Wrath_" Dial
wrath@calc.org
ICQ#3608935
Member of TCPA - tcpa.calc.org
_____________________________________________
NetZero - Defenders of the Free World
Click here for FREE Internet Access and Email
http://www.netzero.net/download/index.html



References: