Use TestUtil.nextInt() instead of random().nextInt()

This commit is contained in:
Shai Erera 2022-06-25 17:56:20 +03:00
parent f6bb9d218c
commit ef486ea11a
2 changed files with 10 additions and 8 deletions

View File

@ -26,6 +26,7 @@ import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.MatchAllDocsQuery;
import org.apache.lucene.store.Directory;
import org.apache.lucene.tests.index.RandomIndexWriter;
import org.apache.lucene.tests.util.TestUtil;
public class TestExactFacetSetMatcher extends FacetTestCase {
@ -98,7 +99,7 @@ public class TestExactFacetSetMatcher extends FacetTestCase {
int numMatchingDocs = 0;
for (int i = 0; i < 100; i++) {
Document doc = new Document();
int numSets = random().nextInt(1, 4);
int numSets = TestUtil.nextInt(random(), 1, 4);
Collections.shuffle(allSets, random());
LongFacetSet[] facetSets = allSets.subList(0, numSets).toArray(LongFacetSet[]::new);
boolean matchingDoc = false;
@ -160,7 +161,7 @@ public class TestExactFacetSetMatcher extends FacetTestCase {
int numMatchingDocs = 0;
for (int i = 0; i < 100; i++) {
Document doc = new Document();
int numSets = random().nextInt(1, 4);
int numSets = TestUtil.nextInt(random(), 1, 4);
Collections.shuffle(allSets, random());
IntFacetSet[] facetSets = allSets.subList(0, numSets).toArray(IntFacetSet[]::new);
boolean matchingDoc = false;
@ -222,7 +223,7 @@ public class TestExactFacetSetMatcher extends FacetTestCase {
int numMatchingDocs = 0;
for (int i = 0; i < 100; i++) {
Document doc = new Document();
int numSets = random().nextInt(1, 4);
int numSets = TestUtil.nextInt(random(), 1, 4);
Collections.shuffle(allSets, random());
DoubleFacetSet[] facetSets = allSets.subList(0, numSets).toArray(DoubleFacetSet[]::new);
boolean matchingDoc = false;
@ -284,7 +285,7 @@ public class TestExactFacetSetMatcher extends FacetTestCase {
int numMatchingDocs = 0;
for (int i = 0; i < 100; i++) {
Document doc = new Document();
int numSets = random().nextInt(1, 4);
int numSets = TestUtil.nextInt(random(), 1, 4);
Collections.shuffle(allSets, random());
FloatFacetSet[] facetSets = allSets.subList(0, numSets).toArray(FloatFacetSet[]::new);
boolean matchingDoc = false;

View File

@ -26,6 +26,7 @@ import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.MatchAllDocsQuery;
import org.apache.lucene.store.Directory;
import org.apache.lucene.tests.index.RandomIndexWriter;
import org.apache.lucene.tests.util.TestUtil;
public class TestRangeFacetSetMatcher extends FacetTestCase {
@ -54,7 +55,7 @@ public class TestRangeFacetSetMatcher extends FacetTestCase {
int numMatchingDocs = 0;
for (int i = 0; i < 100; i++) {
Document doc = new Document();
int numSets = random().nextInt(1, 4);
int numSets = TestUtil.nextInt(random(), 1, 4);
Collections.shuffle(allSets, random());
LongFacetSet[] facetSets = allSets.subList(0, numSets).toArray(LongFacetSet[]::new);
boolean matchingDoc = false;
@ -138,7 +139,7 @@ public class TestRangeFacetSetMatcher extends FacetTestCase {
int numMatchingDocs = 0;
for (int i = 0; i < 100; i++) {
Document doc = new Document();
int numSets = random().nextInt(1, 4);
int numSets = TestUtil.nextInt(random(), 1, 4);
Collections.shuffle(allSets, random());
IntFacetSet[] facetSets = allSets.subList(0, numSets).toArray(IntFacetSet[]::new);
boolean matchingDoc = false;
@ -222,7 +223,7 @@ public class TestRangeFacetSetMatcher extends FacetTestCase {
int numMatchingDocs = 0;
for (int i = 0; i < 100; i++) {
Document doc = new Document();
int numSets = random().nextInt(1, 4);
int numSets = TestUtil.nextInt(random(), 1, 4);
Collections.shuffle(allSets, random());
DoubleFacetSet[] facetSets = allSets.subList(0, numSets).toArray(DoubleFacetSet[]::new);
boolean matchingDoc = false;
@ -314,7 +315,7 @@ public class TestRangeFacetSetMatcher extends FacetTestCase {
int numMatchingDocs = 0;
for (int i = 0; i < 100; i++) {
Document doc = new Document();
int numSets = random().nextInt(1, 4);
int numSets = TestUtil.nextInt(random(), 1, 4);
Collections.shuffle(allSets, random());
FloatFacetSet[] facetSets = allSets.subList(0, numSets).toArray(FloatFacetSet[]::new);
boolean matchingDoc = false;