RE: A83: Random Numbers


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

RE: A83: Random Numbers



Robert, 

Random numbers are usually generated between zero and one.  You have to scale the random number by multiplying it by the maximum number you will allow.  In your case, generate the random number and multiply it by 100, then compare it to 65.  I can't help you with the assembly code, because I have only done asm work with the motorola hc11 microcontrollers.  Hope this is what you are looking for.

Mike

-----Original Message-----
From:	robert m. gardner [SMTP:lilprog@prairienet.org]
Sent:	Thursday, December 11, 1997 7:40 AM
To:	TI-83 ASSEMBLY
Subject:	A83: Random Numbers




I am having a hard time using random numbers, I can generate them, and 
move them to op1, but how can I use that to compare it to a set value, 
say like 65, if I want the rand value to range from 1 to 100?

Here is what I got so far:

call	_random
ld	a,100
call	_setxxop2
call	_fpmult
ld	a,65
call	_setxxop2
call	_cpop1op2

now what? How do I test the cpop1op2, and am I generating the random number
right?


Rob



|-----------------------------------------------------------|
|Robert M. Gardner          | Turbo C++ Programmer          |
|Lilprog@prairienet.org     | HTML Web page writer          |
|Parkland Cross Country     | Knows Unix, Dos, and Windows  | 
|-----------------------------------------------------------|

Warning
Could not process part with given Content-Type: application/ms-tnef