LoremIpsum { public static double variance(double[] values) { double[] squared = new double[values.length]; for (int i = 0; i < values.length; i++) { squared[i] = values[i] * values[i]; } double meanVal = mean(values); return mean(squared) - (meanVal * meanVal); } LoremIpsum();  LoremIpsum(String sample, String dictionary);  LoremIpsum(String sample, String[] newDictionary);  LoremIpsum(String sample); String generateParagraph(boolean optStartWithLorem); String generateSentence(boolean optStartWithLorem); String getSample(); void setSample(String sample); String getDictionary(); void setDictionary(String dictionary); static double mean(int[] values); static double mean(double[] values); static double variance(double[] values); static double sigma(int[] values); static double sigma(double[] values); static int sum(int[] values); static double sum(double[] values); static boolean contains(String[] array, String val); String generateParagraphsHtml(int quantity, boolean startWithLorem); void generateParagraphsHtml(Appendable writer, int quantity, boolean startWithLorem); String generateOneParagraphHtml(int quantity, boolean startWithLorem); String generateParagraphsFullHtml(int quantity, boolean startWithLorem); void generateParagraphsFullHtml(Appendable writer, int quantity, boolean startWithLorem); String generateParagraphsPlainText(int quantity, boolean startWithLorem); void generateParagraphsPlainText(Appendable writer, int quantity, boolean startWithLorem); String generateParagraphsPlainText(int quantity, int maxCols, boolean startWithLorem); void generateParagraphsPlainText(Appendable writer, int quantity, int maxCols, boolean startWithLorem);  }
@Test public void test_variance() { double[] ia1 = { 6.0d, 6.0d, 4.0d, 4.0d }; assertEquals(1.0d, LoremIpsum.variance(ia1), 0.01d); double[] ia2 = { 1.0d, 2.0d, 3.0d, 4.0d }; assertEquals(1.25d, LoremIpsum.variance(ia2), 0.01d); }