Page 1 of 1

help with science fair question

PostPosted: Sat Jul 05, 2008 12:41 pm
by tlah
I am making a code in game editor for my upcoming science fair. I need it to write a random number from 1-6, without deciamls. So far, it says stuff like "4.7185386914". help me!

Re: help with science fair question

PostPosted: Sat Jul 05, 2008 2:48 pm
by Thanx
I don't think you've been using the
rand
function, have you?
rand(6); or rand(5) + 1;
that should do it, and as far as I know, it gives integers back doesn't it?
or else:
do this: I know you used some function, do this:
round(the function used);
that'll rond the double to the closest integer!
:wink: Cheers! Good luck with the science fair! :) 8)

Re: help with science fair question

PostPosted: Sat Jul 05, 2008 5:43 pm
by tlah
Thanx wrote:I don't think you've been using the
rand
function, have you?
rand(6); or rand(5) + 1;
that should do it, and as far as I know, it gives integers back doesn't it?
or else:
do this: I know you used some function, do this:
round(the function used);
that'll rond the double to the closest integer!
:wink: Cheers! Good luck with the science fair! :) 8)

thanks! i have been using rand(6) and unsucsessfully tried round. I'm gonna try the round function your way.