Creates a new dense matrix filled with random values from Random#nextDouble() @param rows the number of rows for the matrix @param cols the number of columns for the matrix @param rand the source of randomness @return a new dense matrix full of random values
(int rows, int cols, Random rand)
| 991 | * @return a new dense matrix full of random values |
| 992 | */ |
| 993 | public static DenseMatrix random(int rows, int cols, Random rand) |
| 994 | { |
| 995 | DenseMatrix m = new DenseMatrix(rows, cols); |
| 996 | for(int i = 0; i < rows; i++) |
| 997 | for(int j = 0; j < cols; j++) |
| 998 | m.set(i, j, rand.nextDouble()); |
| 999 | |
| 1000 | return m; |
| 1001 | } |
| 1002 | |
| 1003 | /** |
| 1004 | * Returns a new dense square matrix such that the main diagonal contains |