3 ms·
Hmph - second hit is in the OpenJDK code. I guess the author forgot to include braces and so randomDelay() always has a delay of 0.
by lyso 17y ago
Hmph - second hit is in the OpenJDK code. I guess the author forgot to include braces and so randomDelay() always has a delay of 0.
- noss 17y agoLooking at it, it seems to be in a regression test.
- vlisivka 17y agoint runs = (int) Math.random() * 1000000; is equivalent to int runs = (int) (Math.random() * 1000000); This search is better ( "\s?[;)]" is added at the end): http://www.google.com/codesearch?hl=en&lr=&q=\%28int\%29\s*Math\.random\%28\%29\s*[%3B%29]&sbtn=Search http://www.google.com/codesearch?hl=en&lr=&q=\%28int...
- danparsonson 17y agoActually it looks like casting (being a unary operator) takes precedence over multiplication: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/operators.html http://java.sun.com/docs/books/tutorial/java/nutsandbolts/op... http://www.cs.uwf.edu/~eelsheik/cop2253/resources/op_precedence.html http://www.cs.uwf.edu/~eelsheik/cop2253/resources/op_precede...
- jonsen 17y agoRight: http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#238146 http://java.sun.com/docs/books/jls/second_edition/html/expre...
- fhars 17y agoNo. class Test { public Test() {} public static void main(String[] argv) { int i; for (i = 0; i < 100; i += 1) { System.out.println("RND=" + ((int) Math.random() * 100000)); } } }