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

Method testRandom

JSAT/test/jsat/linear/MatrixTest.java:131–146  ·  view source on GitHub ↗

Test of random method, of class Matrix.

()

Source from the content-addressed store, hash-verified

129 * Test of random method, of class Matrix.
130 */
131 @Test
132 public void testRandom()
133 {
134 System.out.println("random");
135 int rows = 100;
136 int cols = 100;
137 Random rand = RandomUtil.getRandom();
138
139 DenseMatrix result = Matrix.random(rows, cols, rand);
140 OnLineStatistics stats = new OnLineStatistics();
141 for (int i = 0; i < result.rows(); i++)
142 for (int j = 0; j < result.cols(); j++)
143 stats.add(result.get(i, j));
144 //if its all random from [0, 1], the mean should be 0.5
145 assertEquals(0.5, stats.getMean(), 0.05);
146 }
147
148 /**
149 * Test of diag method, of class Matrix.

Callers

nothing calls this directly

Calls 7

getRandomMethod · 0.95
randomMethod · 0.95
rowsMethod · 0.95
colsMethod · 0.95
addMethod · 0.95
getMethod · 0.95
getMeanMethod · 0.95

Tested by

no test coverage detected