I want to generate number between 30 to 80 and for that i use:
this.length=(float)(Math.random()*50+30);
Then i have to parse a few parameters of instance to string:
result=this.name+" by "+this.smith+" in "+this.productionYear+" at "+this.length+" length";
It generates string looking like this:
Lao Che by Youta in 1327 at 75.341866 length
How could i truncate length to have less decimal precision? I would like to set it to 2 digits after dot.