Re:A common bug in published code
by Adrock on Thursday April 21, 2011 @05:53PM
(#2472547)
See the previous HN discussion: http://news.ycombinator.com/item?id=960886
[ Parent
| on HN ]
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);