MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / random

Method random

JSAT/src/jsat/linear/Matrix.java:993–1001  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Calls 2

setMethod · 0.95
nextDoubleMethod · 0.45