mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robina...@apache.org
Subject svn commit: r1489462 - /mahout/trunk/core/src/test/java/org/apache/mahout/math/VectorWritableTest.java
Date Tue, 04 Jun 2013 14:59:49 GMT
Author: robinanil
Date: Tue Jun  4 14:59:41 2013
New Revision: 1489462

URL: http://svn.apache.org/r1489462
Log:
MAHOUT-1240 Change VectorWritableTest to use random generator from the super class

Modified:
    mahout/trunk/core/src/test/java/org/apache/mahout/math/VectorWritableTest.java

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/math/VectorWritableTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/math/VectorWritableTest.java?rev=1489462&r1=1489461&r2=1489462&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/math/VectorWritableTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/math/VectorWritableTest.java Tue Jun
 4 14:59:41 2013
@@ -20,10 +20,8 @@ import java.io.ByteArrayOutputStream;
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
-import java.util.Random;
 
 import org.apache.hadoop.io.Writable;
-import org.apache.mahout.common.RandomUtils;
 import org.apache.mahout.math.Vector.Element;
 import org.junit.Test;
 
@@ -33,12 +31,11 @@ import com.google.common.io.Closeables;
 
 public final class VectorWritableTest extends RandomizedTest {
   private static final int MAX_VECTOR_SIZE = 100;
-  private final Random r = RandomUtils.getRandom();
 
   public void createRandom(Vector v) {
-    int size = r.nextInt(v.size());
+    int size = randomInt(v.size() - 1);
     for (int i = 0; i < size; ++i) {
-      v.set(r.nextInt(v.size()), r.nextDouble());
+      v.set(randomInt(v.size() - 1), randomDouble());
     }
 
     int zeros = Math.max(2, size / 4);



Mime
View raw message