Simple DOuble to Integer Question.
Code:
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/7...leerrorxq7.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?
Re: Simple DOuble to Integer Question.
Code:
double value1 = 1.5;
int value = (int)value1;
value will be assigned the value of 1.
When you explicitly cast a double to an int the fractional part gets truncated.
Re: Simple DOuble to Integer Question.
it worked :!:!!:!:!: ty so much