NormalRandomNumberGenerator implements RandomNumberGenerator { @Override public List<double[]> getVectors(final int dimension, final int n) { if (dimension < 0) { throw new IllegalArgumentException("Dimension must be greater than zero"); } if (n < 0) { throw new IllegalArgumentException("Number of values must be greater than zero"); } final List<double[]> result = new ArrayList<>(n); double[] x; for (int i = 0; i < n; i++) { x = new double[dimension]; for (int j = 0; j < dimension; j++) { x[j] = _normal.nextRandom(); } result.add(x); } return result; } NormalRandomNumberGenerator(final double mean, final double sigma);  NormalRandomNumberGenerator(final double mean, final double sigma, final RandomEngine engine); @Override double[] getVector(final int dimension); @Override List<double[]> getVectors(final int dimension, final int n);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testBadDimension() { GENERATOR.getVectors(-1, 4); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testBadN() { GENERATOR.getVectors(1, -5); }
@Test public void test() { final List<double[]> result = GENERATOR.getVectors(10, 50); assertEquals(result.size(), 50); for (final double[] d : result) { assertEquals(d.length, 10); } }