Discussion forum for the BasicX family of microcontroller chips.
:? A Question of mathimatical nature - ryan_autet - May 20 19:41:59 2007
Hi
Ok After lots of coding iv run into a problem.
Public Sub Random_Stat()
'Call Randomize
Result1 = (Rnd / 100.00000E-03)
Call Random_Sound_Stat
Call Delay(0.01)
Debug.Print "R1: "; CStr(Result1)
End Sub
Ok i get a result between 1.0-9.0
But what i would realy like is to remove the decimal point and a
difinitive number between 1-10
So i can say if result = 2 is would actualy = 2 rather 2. some thing
now after thinking about this im sure it could worked out in an
equasion some how :?
exept math was never my strong suit so
my question is have any of u gentalmen tryed some thing like this
befor?
if so would you happen to have the eqasion kickin around?

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )
Re: :? A Question of mathematics - Tom Becker - May 20 20:55:54 2007
> ... I get a result between 1.0-9.0 [but want] a number between 1-10...
The Fix() function will do what you want. For an input >=0.0 and <10.0,
Fix will yield a floating point whole number between 0 and 9. If you
really want 1 to 10, add one.
Tom

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )
Re: :? A Question of mathematics - ryan_autet - May 20 21:07:28 2007
--- In b...@yahoogroups.com, Tom Becker
wrote:
>
> > ... I get a result between 1.0-9.0 [but want] a number between 1-
10...
>
> The Fix() function will do what you want. For an input >=0.0 and
<10.0,
> Fix will yield a floating point whole number between 0 and 9. If you
> really want 1 to 10, add one.
> Tom
>
ah i looked it up thanks Tom, as allways yours man ;)

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )