Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Oh, so it always rounds down to zero, that's pretty bad. Casting it to a double would help right?


Instead of

int runs = (int) Math.random() * 1000000;

You'd do

int runs = (int) (Math.random() * 1000000);


That would be pointless, because Math.round already returns a double.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: