public static double[][] generateTestMatrix(int rows,int cols,double min,double max,double sparsity,long seed){
  double[][] matrix=new double[rows][cols];
  Random random;
  if (seed == -1)   random=new Random(System.nanoTime());
 else   random=new Random(seed);
  for (int i=0; i < rows; i++) {
    for (int j=0; j < cols; j++) {
      if (random.nextDouble() > sparsity)       continue;
      matrix[i][j]=(random.nextDouble() * (max - min) + min);
    }
  }
  return matrix;
}

public static double [ ] [ ] generateTestMatrix ( int rows , int cols , double min , double max , double sparsity , long seed ) { double [ ] [ ] matrix = new double [ rows ] [ cols ] ; Random random ; if ( seed == - 1 ) random = new Random ( System . nanoTime ( ) ) ; else random = new Random ( seed ) ; for ( int i = 0 ; i < rows ; i ++ ) { for ( int j = 0 ; j < cols ; j ++ ) { if ( random . nextDouble ( ) > sparsity ) continue ; matrix [ i ] [ j ] = ( random . nextDouble ( ) * ( max - min ) + min ) ; } } return matrix ; }
note : this is a copy of testutils . generatetestmatrix , it was replicated in order to prevent dependency of systemml . jar to our test package .
