goaganesha
Programmer
Hello,
I'm trying to generate a random int between 1 and 39.
If I use:
int count = Math.round(Math.ceil(Math.random()*39));
I keep getting following compiler error:
possible loss of precision:long,required: int
If I use:
long count = Math.round(Math.ceil(Math.random()*39));
it works fine but it seems impossible to cast count back to an int.
Any suggestions?
thanks in advance, goaganesha
I'm trying to generate a random int between 1 and 39.
If I use:
int count = Math.round(Math.ceil(Math.random()*39));
I keep getting following compiler error:
possible loss of precision:long,required: int
If I use:
long count = Math.round(Math.ceil(Math.random()*39));
it works fine but it seems impossible to cast count back to an int.
Any suggestions?
thanks in advance, goaganesha