20 ms·
public class example { public static void main(String[] JAVA_LOL) throws Throwable { // prints "6" System.out.println((int)6.9
by anonymoushn 16y ago
public class example
{
public static void main(String[] JAVA_LOL) throws Throwable
{
// prints "6"
System.out.println((int)6.99999);
}
}
- ZoFreX 16y agoYou (and everyone else) are of course right. I remembered the wrong thing, what I said doesn't apply to that method in Java. What does apply is that there are lots of subtleties in generating random numbers, and there's rarely a reason to re-invent the wheel. There's a good example of how subtle pseudorandomness is in the Java documentation, so I will link that instead of embarrassing myself further: http://download.oracle.com/javase/1.4.2/docs/api/java/util/Random.html#nextDouble() http://download.oracle.com/javase/1.4.2/docs/api/java/util/R...