You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by to...@apache.org on 2013/02/20 14:19:02 UTC

svn commit: r1448155 - /lucene/dev/branches/branch_4x/lucene/classification/src/test/org/apache/lucene/classification/utils/DataSplitterTest.java

Author: tommaso
Date: Wed Feb 20 13:19:01 2013
New Revision: 1448155

URL: http://svn.apache.org/r1448155
Log:
LUCENE-4781 - fixed forbidden APIs (java.util.Random)

Modified:
    lucene/dev/branches/branch_4x/lucene/classification/src/test/org/apache/lucene/classification/utils/DataSplitterTest.java

Modified: lucene/dev/branches/branch_4x/lucene/classification/src/test/org/apache/lucene/classification/utils/DataSplitterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/classification/src/test/org/apache/lucene/classification/utils/DataSplitterTest.java?rev=1448155&r1=1448154&r2=1448155&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/classification/src/test/org/apache/lucene/classification/utils/DataSplitterTest.java (original)
+++ lucene/dev/branches/branch_4x/lucene/classification/src/test/org/apache/lucene/classification/utils/DataSplitterTest.java Wed Feb 20 13:19:01 2013
@@ -62,15 +62,15 @@ public class DataSplitterTest extends Lu
     ft.setStoreTermVectorOffsets(true);
     ft.setStoreTermVectorPositions(true);
 
-    Analyzer analyzer = new MockAnalyzer(new Random());
+    Analyzer analyzer = new MockAnalyzer(random());
 
     Document doc;
     for (int i = 0; i < 100; i++) {
       doc = new Document();
-      doc.add(new Field(idFieldName, new Random().toString(), ft));
-      doc.add(new Field(textFieldName, new StringBuilder(new Random().toString()).append(new Random().toString()).append(
-          new Random().toString()).toString(), ft));
-      doc.add(new Field(classFieldName, new Random().toString(), ft));
+      doc.add(new Field(idFieldName, random().toString(), ft));
+      doc.add(new Field(textFieldName, new StringBuilder(random().toString()).append(random().toString()).append(
+          random().toString()).toString(), ft));
+      doc.add(new Field(classFieldName, random().toString(), ft));
       indexWriter.addDocument(doc, analyzer);
     }
 
@@ -108,7 +108,7 @@ public class DataSplitterTest extends Lu
 
     try {
       DatasetSplitter datasetSplitter = new DatasetSplitter(testRatio, crossValidationRatio);
-      datasetSplitter.split(originalIndex, trainingIndex, testIndex, crossValidationIndex, new MockAnalyzer(new Random()), fieldNames);
+      datasetSplitter.split(originalIndex, trainingIndex, testIndex, crossValidationIndex, new MockAnalyzer(random()), fieldNames);
 
       assertNotNull(trainingIndex);
       assertNotNull(testIndex);