public static float[][] randomInit(int rows,int cols,Random random){
  float[][] output=new float[rows][cols];
  for (int i=0; i < rows; ++i) {
    for (int j=0; j < cols; ++j) {
      output[i][j]=(2 * random.nextFloat()) - 1;
    }
  }
  return output;
}

public static float [ ] [ ] randomInit ( int rows , int cols , Random random ) { float [ ] [ ] output = new float [ rows ] [ cols ] ; for ( int i = 0 ; i < rows ; ++ i ) { for ( int j = 0 ; j < cols ; ++ j ) { output [ i ] [ j ] = ( 2 * random . nextFloat ( ) ) - 1 ; } } return output ; }
returns a randomly initialized matrix with values between - 1 and 1 , of the given size .
