SOLR-264: equivalent logic without branch

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@548599 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2007-06-19 06:03:10 +00:00
parent 59ed1b5bf1
commit c06888092b
1 changed files with 1 additions and 1 deletions

View File

@ -58,7 +58,7 @@ public class RandomSortField extends FieldType
final Random rand = new Random();
public int compare (ScoreDoc i, ScoreDoc j) {
return (rand.nextBoolean()) ? 1 : -1; //rand.nextInt() >>> 31; ??
return (rand.nextInt() & 0x2) - 1; // (rand.nextBoolean()) ? 1 : -1;
}
public Comparable sortValue (ScoreDoc i) {
return new Float(rand.nextFloat());