@Override AbstractDistribution create(Random random) { return new Uniform(0, 1, random); } },
@Test public void testUniform() { Random gen = RandomUtils.getRandom(); for (int i = 0; i < repeats(); i++) { runTest(new Uniform(0, 1, gen), 100, new double[]{0.001, 0.01, 0.1, 0.5, 0.9, 0.99, 0.999}, "uniform", true, gen); } }
@Test public void compareToQDigest() { Random rand = RandomUtils.getRandom(); for (int i = 0; i < repeats(); i++) { compare(new Gamma(0.1, 0.1, rand), "gamma", 1L << 48, rand); compare(new Uniform(0, 1, rand), "uniform", 1L << 48, rand); } }
@Test public void testNarrowNormal() { // this mixture of a uniform and normal distribution has a very narrow peak which is centered // near the median. Our system should be scale invariant and work well regardless. final Random gen = RandomUtils.getRandom(); AbstractContinousDistribution mix = new AbstractContinousDistribution() { AbstractContinousDistribution normal = new Normal(0, 1e-5, gen); AbstractContinousDistribution uniform = new Uniform(-1, 1, gen); @Override public double nextDouble() { double x; if (gen.nextDouble() < 0.5) { x = uniform.nextDouble(); } else { x = normal.nextDouble(); } return x; } }; for (int i = 0; i < repeats(); i++) { runTest(mix, 100, new double[]{0.001, 0.01, 0.1, 0.3, 0.5, 0.7, 0.9, 0.99, 0.999}, "mixture", false, gen); } }
@SuppressWarnings("UnusedDeclaration") public void setEnd(String end) throws ParseException { this.end = df.parse(end).getTime(); base = new Uniform(0, this.end - this.start, RandomUtils.getRandom()); }
@SuppressWarnings("UnusedDeclaration") public void setStart(String start) throws ParseException { this.start = df.parse(start).getTime(); base = new Uniform(0, this.end - this.start, RandomUtils.getRandom()); }
Uniform u = new Uniform(gen); for (int j = 0; j < totalItems; j++) { prob[j] = u.nextDouble();
System.out.println("do stuff"); response.setOnSent(new Uniform() {
client.handle(request, new Uniform() { @Override public void handle(Request request, Response response) {