TexasMd91
Apr 21st, 2007, 10:00 PM
int GambleCash = 1000;
double RandomGamble = Math.random();
int GambleReturnCash = (((GambleCash * 1.5) - (GambleCash / 2) + 1) * RandomGamble) +(GambleCash / 2);
And heres the error that i get.
http://img221.imageshack.us/img221/7597/compileerrorxq7.gif
Im guessing its because RandomGamble is a double which is needed for Math.random because its random 0 to 1 so its decimals which needs double.
so how can you change a double to an integer?
double RandomGamble = Math.random();
int GambleReturnCash = (((GambleCash * 1.5) - (GambleCash / 2) + 1) * RandomGamble) +(GambleCash / 2);
And heres the error that i get.
http://img221.imageshack.us/img221/7597/compileerrorxq7.gif
Im guessing its because RandomGamble is a double which is needed for Math.random because its random 0 to 1 so its decimals which needs double.
so how can you change a double to an integer?