random without decimal
Posted:
Fri May 15, 2009 3:29 pm
by futuro
you know if one random haven't decimal?
I need one number of 12 posible, but random..
help
Re: random without decimal
Posted:
Fri May 15, 2009 8:50 pm
by jimmynewguy
if it's an integer(int) it won't have numbers, so you can do this 2 ways
- Code: Select all
int j;
j = rand(12);//for textNumber just have it = j and it won't have a decimal
~~~OR~~~
- Code: Select all
variable = round(rand(12);
Re: random without decimal
Posted:
Fri May 15, 2009 9:26 pm
by Hblade
Or you could make the int a float variables instead of int. Float can never have decimals. To do this, get the name of your current variable, delete it. In Global Code, type float variable. Replace variable with the name of your variable.
Re: random without decimal
Posted:
Sat May 16, 2009 2:45 am
by pyrometal
False! A float IS a real number (float as in "floating point"). A double is also decimal number but can contain larger numbers with higher precision in the decimals, (double stands for "double precision"). The use of an integer in this case is appropriate. Sorry for the contradiction Hblade...
Re: random without decimal
Posted:
Sat May 16, 2009 7:45 am
by futuro
the problem is that GE not use
- Code: Select all
byte
whith eigth posibilitys I can work also
jimmynewguy = jimmynewpoint
thanks