code: public static void symmetric(DMatrixRMaj A, double min, double max, Random rand) {
          if( A.numRows != A.numCols )
              throw new IllegalArgumentException("A must be a square matrix");
  
          double range = max-min;
  
          int length = A.numRows;
  
          for( int i = 0; i < length; i++ ) {
              for( int j = i; j < length; j++ ) {
                  double val = rand.nextDouble()*range + min;
                  A.set(i,j,val);
                  A.set(j,i,val);
              }
          }
      }
docs: Sets the provided square matrix to be a random symmetric matrix whose values are selected from an uniform distribution
  from min to max, inclusive.
  
  @param A The matrix that is to be modified.  Must be square.  Modified.
  @param min Minimum value an element can have.
  @param max Maximum value an element can have.
  @param rand Random number generator.