Vectors { public static double[][] randomVectors(final int nVectors) { return Stream.generate(Vectors::randomVector).limit(nVectors).toArray( double[][]::new); } private  Vectors(); static double[] randomVector(); static double[][] randomVectors(final int nVectors); static double[][] regularVectors(final int nVectors);  }
@Test public void testRandomVectors() { final int n = 1000; final double[][] v = Vectors.randomVectors(n); for (int i = 0; i < n; i++) { final double x = v[i][0]; final double y = v[i][1]; final double z = v[i][2]; final double length = Math.sqrt(x * x + y * y + z * z); assertEquals(1, length, 1e-9); } }