/** Test of createUniformRandom method, of class MatrixFactory. */
  public void testCreateUniformRandom() {
    System.out.println("createUniformRandom");

    Matrix m = this.createRandomMatrix();
    MatrixFactory<?> factory = this.createFactory();

    int M = m.getNumRows();
    int N = m.getNumColumns();
    Matrix mr = factory.createUniformRandom(M, N, -RANGE, RANGE, random);
    assertNotNull(mr);
    assertNotSame(m, mr);
    assertEquals(M, mr.getNumRows());
    assertEquals(N, mr.getNumColumns());

    boolean nonzero = false;
    for (int i = 0; i < M; i++) {
      for (int j = 0; j < N; j++) {
        double value = mr.getElement(i, j);
        if (value != 0.0) {
          nonzero = true;
          if ((value < -RANGE) || (value > RANGE)) {
            fail("Nonzero value outside the given range!");
          }
        }
      }
    }

    if (!nonzero) {
      fail("I didn't find any nonzero values in your random matrix!!");
    }
  }
 @Override
 public Matrix init(int rows, int cols) {
   final SparseMatrix rand = (SparseMatrix) smf.createUniformRandom(rows, cols, min, max, random);
   final Matrix ret = smf.createMatrix(rows, cols);
   for (int i = 0; i < rows; i++) {
     if (this.random.nextDouble() > sparcity) {
       ret.setRow(i, rand.getRow(i));
     }
   }
   return ret;
 }