Package com.facebook.LinkBench.distributions

Examples of com.facebook.LinkBench.distributions.UniformDistribution


    testSanityBuiltinDist(AccessDistMode.ROUND_ROBIN, 0);
  }

  @Test
  public void testUniform() {
    UniformDistribution u = new UniformDistribution();
    Properties props = new Properties();
    int min = 100, max = 200;
    u.init(min, max, props, "");
    ProbAccessDistribution unshuffled = new ProbAccessDistribution(u, null);
    testSanityAccessDist(unshuffled, min, max);

    ProbAccessDistribution shuffled = new ProbAccessDistribution(u,
                        new InvertibleShuffler(13, 25, max - min));
View Full Code Here


public class UniformDistTest extends DistributionTestBase {

  @Override
  public ProbabilityDistribution getDist() {
    return new UniformDistribution();
  }
View Full Code Here

    long maxes[] = {(long)Math.pow(2, 31.5), (long)Math.pow(2, 34.23)};
    int trials = 10000;
    Random rng = new Random();

    for (long max: maxes) {
      UniformDistribution dist = new UniformDistribution();
      dist.init(0, max, 1);
      for (int trial = 0; trial < trials; trial++) {
        long i = dist.choose(rng);
        assertTrue(i >= 0);
        assertTrue(i < max);
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.facebook.LinkBench.distributions.UniformDistribution

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.