Generating Data Points for Testing


Need to generate data points that fall on a normal distribution curve? Try this:

    import java.util.Random;

    Integer MEAN = 340 * 1024;
    Integer STDEV = 20 * 1024;

    double guassian = new Random().nextGaussian();
    int size = MEAN + (int) (guassian * STDEV);

This was something I needed for the upcoming update to the Guava IO chapter… expect that in about a week.